开发者

string to RemoteEndPoint C# by sendto

开发者 https://www.devze.com 2023-01-06 00:23 出处:网络
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:

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

精彩评论

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