客户端和服务器端通信

 Socket 类中提供的TCPClient  NetWorkStream TCPListener 

客户端

TcpClient tcpClient=new TcpCLient(主机IP,端口号);
NetworkStream ns=tcp.Client.GetStream();

  服务端

TcpListener tcpListener=new TcpListener(监听端口);
tcpListener.Start();
TcpClient tcpClient=tcpListener.AcceptTcpClient();
NetworkStream ns=tcpClient.GetStream();

你可能感兴趣的:(socket,服务器)