string to RemoteEndPoint C# by sendto
How can I convert a开发者_如何学Go string to RemoteEndPoint ?
RemoteEndPoint is a property of a Socket, so you'd need to create a Socket first:
IPEndPoint ip = new IPEndPoint(address, port);
Socket mySocket = new Socket(ip.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
So if you have a string something like "127.0.0.1:25", you need to grab the address and port components. Try myEndPointString.Split(":") to get the two components out.
精彩评论