[Mono-list] Is TcpClient complete?

Arx Henrique arxcruz at gmail.com
Sat Sep 3 10:11:17 EDT 2005


Hi all

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:

public class Test {
        public static void Main() {
                TcpClient client;
                NetworkStream output;
                BinaryWriter writer;
                try {
                        string post =
"/serviceStart?service=internet_AABA HTTP/1.0\r\n";
                        string confirmed = "confirmed=true";
                        client = new TcpClient();
                        client.Connect("www.veloxzone.com.br", 80);
                        output = client.GetStream();
                        reader = new BinaryReader(output);
                        writer = new BinaryWriter(output);

                        writer.Write("POST " + post);
                        writer.Write("Content-Type:
application/x-www-form-urlencoded\r\n");
                        writer.Write("Host: www.veloxzone.com.br\r\n");
                        writer.Write("Content-Length: " +
confirmed.Length + "\r\n");
                        writer.Write("\r\n" + confirmed + "\r\n\r\n\r\n");
                        writer.Flush();
                        writer.Close();
                        output.Close();
                        client.Close();

                } catch (Exception e) {
                        System.Console.WriteLine("erro :(");
                        System.Console.WriteLine(e.ToString());
                }
        }
}

"A fé remove montanas, mas eu prefiro a dinamite"


More information about the Mono-list mailing list