[Mono-list] Re: Is TcpClient complete?

Robert Jordan robertj at gmx.net
Sat Sep 3 11:24:56 EDT 2005


Hi,

> Is TcpClient complete? i'm try to use this class to make a
> authenticator to my isp, but dont works, or am i do wrong?
> i'm want to connect to site, and send a post command:

TcpClient is ok, unlike your ad-hoc HTTP implementation.
Have a look at the already to be used HTTP client class
System.Net.WebClient:

using System.Collections.Specialized;
using System.Net;
using System.Text;

using (WebClient wc = new WebClient ()) {
   NameValueCollection values = new NameValueCollection ();
   values ["confirmed"] = "true";
   byte[] res = wc.UploadValues ("http://....", "POST", values);
   Console.WriteLine (Encoding.ASCII.GetString(res));
}

Rob



More information about the Mono-list mailing list