开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜