public void Open() { if (_opened.CheckAndSet()) { return; } _listenSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); _listenSocket.Bind(new IPEndPoint(IPAddressHelper.ParseIPAddress("localhost"), 12345)); _listenSocket.Listen(1); _listenThread = new Thread(Listen); _listenThread.Start(); }