这段代码报错,疑惑。。。
Socket sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); sock.Connect(new IPEndPoint(IPAddress.Parse( "222.45.12.55 "), 5001)); if(sock.Connected) { byte[] buff = Encoding.ASCII.GetBytes(strSendMessage); sock.Send(buff, 0, buff.Length, SocketFlags.None); byte[] recvBuff = new byte[2048]; int bytes = sock.Receive(buff, 0, recvBuff.Length, SocketFlags.None); string rs = Encoding.ASCII.GetString(buff, 0, bytes); //接受到的字符串 } sock.Close();