private static void Main(string[] args) { TcpClient ourMagicClient = new TcpClient(); //Connect to the server - change this IP address to match your server's IP! ourMagicClient.Connect("192.123.0.254", 7000); //Use a NetworkStream object to send and/or receive some data NetworkStream ns = ourMagicClient.GetStream(); byte[] fromClient = new byte[10025]; byte[] toClient; while (ns.Read(fromClient, 0, (int) ourMagicClient.ReceiveBufferSize) > 0) { int nub = ns.Read(fromClient, 0, (int)ourMagicClient.ReceiveBufferSize); string str = Encoding.ASCII.GetString(fromClient, 0, nub); Console.Write(str); toClient = fromClient; ns.Write(toClient, 0, toClient.Length); ns.Flush(); } Console.ReadKey(); }
StreamReader
StreamWriter
NetworkStream
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)