private void _acceptorloop() { while (this._active) { if (!_tcpListener.Pending()) { Thread.Sleep(100); // choose a number (in milliseconds) that makes sense continue; // skip to next iteration of loop } TcpClient clientSocket = default(TcpClient); clientSocket = _tcpListener.AcceptTcpClient(); GSocket gs = new GSocket(clientSocket); if (ClientArrived != null) { ClientArrived(this, gs); } } }
public int Send(string data) { return(this.Send(GSocket.GetBytes(data))); //return this.Send(System.Text.Encoding.UTF8.GetBytes(data)); //return this.Send(new System.Text.ASCIIEncoding().GetBytes(data)); }