C#客户端通过IP端口号连接服务端
返回用来收发数据的套接字
private Socket getSocket(string ip, int p) { Socket socketclient = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); //获取文本框中的IP地址 IPAddress address = IPAddress.Parse(ip); //将获取的IP地址和端口号绑定在网络节点上 IPEndPoint point = new IPEndPoint(address, p); //客户端套接字连接到网络节点上,用的是Connect socketclient.Connect(point); return socketclient; }