/// <summary> /// 服务端/如果Get就会发起Socket地址申请 /// </summary> public static SocketTool GetServerUDP() { if (_ServerUDP == null) { _ServerUDP = new SocketTool(StaticResource.ServerIpaddress, SocketType.Dgram, ProtocolType.Udp); } return(_ServerUDP); }
public static SocketTool GetServerTCP() { if (_ServerTCP == null) { _ServerTCP = new SocketTool(StaticResource.ServerIpaddress, SocketType.Stream, ProtocolType.Tcp); } _ServerTCP.Listen(); return(_ServerTCP); }
/// <summary> /// 别用 尽量用下边的TCPSendMsg /// </summary> /// <returns></returns> public static SocketTool GetClientTCP() { //try //{ // if (_ClientTCP == null) _ClientTCP = new SocketTool(StaticResource.ClientIpaddress, SocketType.Stream, ProtocolType.Tcp); //} //catch //{ // _ClientTCP = new SocketTool(StaticResource.ClientIpaddressSpare, SocketType.Stream, ProtocolType.Tcp); //} //return _ClientTCP; return(_ClientTCP = new SocketTool(StaticResource.ClientIpaddress, SocketType.Stream, ProtocolType.Tcp)); }
/// <summary> /// 客户端/如果Get就会发起Socket地址申请 /// </summary> public static SocketTool GetClientUDP() { try { if (_ClientUDP == null) { _ClientUDP = new SocketTool(StaticResource.ClientIpaddress, SocketType.Dgram, ProtocolType.Udp); } } catch { _ClientUDP = new SocketTool(StaticResource.ClientIpaddressSpare, SocketType.Dgram, ProtocolType.Udp); } return(_ClientUDP); }