private void InitSocket(EndPoint localEP) { if (socket != null) { socket.Close(); socket = null; } socket = new Socket(family, SocketType.Dgram, ProtocolType.Udp); if (localEP != null) socket.Bind(localEP); recBuffer.SetSize(65536); }