/// <summary> /// Callback for Accept Implementation /// </summary> /// <returns> /// TTransport-object. /// </returns> protected override TTransport AcceptImpl() { if (this.server == null) { throw new TTransportException(TTransportException.ExceptionType.NotOpen, "No underlying server socket."); } try { TcpClient client = this.server.AcceptTcpClient(); client.SendTimeout = client.ReceiveTimeout = this.clientTimeout; //wrap the client in an SSL Socket passing in the SSL cert TTLSSocket socket = new TTLSSocket(client, this.serverCertificate, true); socket.setupTLS(); if (useBufferedSockets) { TBufferedTransport trans = new TBufferedTransport(socket); return(trans); } else { return(socket); } } catch (Exception ex) { throw new TTransportException(ex.ToString()); } }
protected override TTransport AcceptImpl() { if (server == null) { throw new TTransportException(TTransportException.ExceptionType.NotOpen, "No underlying server socket."); } try { TSocket result2 = null; TcpClient result = server.AcceptTcpClient(); try { result2 = new TSocket(result); result2.Timeout = clientTimeout; if (useBufferedSockets) { TBufferedTransport result3 = new TBufferedTransport(result2); return(result3); } else { return(result2); } } catch (System.Exception) { // If a TSocket was successfully created, then let // it do proper cleanup of the TcpClient object. if (result2 != null) { result2.Dispose(); } else // Otherwise, clean it up ourselves. { ((IDisposable)result).Dispose(); } throw; } } catch (Exception ex) { throw new TTransportException(ex.ToString()); } }