public static int GetRemotePort(ISocket socket) { if (socket.GetSocket().ProtocolType == ProtocolType.Udp) { throw new ConstraintException("Cannot get remote IP Address of a UDP socket directly. It is returned from the ReceiveMessage as the second item in the Tuple<>"); } var socketEndPoint = (IPEndPoint)socket.GetRemoteEndPoint(); return(socketEndPoint.Port); }
public static IPAddress GetRemoteIpAddress(ISocket socket) { if (socket.GetSocket().ProtocolType == ProtocolType.Udp) { throw new InvalidOperationException("Cannot get remote IP Address of a UDP socket directly. It is returned from the ReceiveMessage as the second item in the Tuple<>"); } var socketEndPoint = (IPEndPoint)socket.GetRemoteEndPoint(); return(socketEndPoint.Address); }
public static int GetRemotePort(ISocket socket) { if (socket.GetSocket().ProtocolType == ProtocolType.Udp) throw new ConstraintException("Cannot get remote IP Address of a UDP socket directly. It is returned from the ReceiveMessage as the second item in the Tuple<>"); var socketEndPoint = (IPEndPoint)socket.GetRemoteEndPoint(); return socketEndPoint.Port; }