/// <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, this.clientCertValidator); socket.setupTLS(); if (useBufferedSockets) { TBufferedTransport trans = new TBufferedTransport(socket); return(trans); } else { return(socket); } } catch (Exception ex) { throw new TTransportException(ex.ToString()); } }
/// <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 { #if NETSTANDARD1_4 || NETSTANDARD1_5 TcpClient client = this.server.AcceptTcpClientAsync().Result; #else TcpClient client = this.server.AcceptTcpClient(); #endif 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, this.clientCertValidator, this.localCertificateSelectionCallback ); socket.setupTLS(); if (useBufferedSockets) { #if NETSTANDARD1_4 throw new NotImplementedException("Not supported with NetStandard 1.4, use NetStandard 1.5 instead."); #else TBufferedTransport trans = new TBufferedTransport(socket); return(trans); #endif } else { return(socket); } } catch (Exception ex) { throw new TTransportException(ex.ToString()); } }
/// <summary> /// Callback for Accept Implementation /// </summary> /// <returns> /// TTransport-object. /// </returns> protected override TTransport AcceptImpl() { if (server == null) { throw new TTransportException(TTransportException.ExceptionType.NotOpen, "No underlying server socket."); } try { var client = server.AcceptTcpClient(); client.SendTimeout = client.ReceiveTimeout = clientTimeout; //wrap the client in an SSL Socket passing in the SSL cert var socket = new TTLSSocket( client, serverCertificate, true, clientCertValidator, localCertificateSelectionCallback, sslProtocols); socket.setupTLS(); if (useBufferedSockets) { var trans = new TBufferedTransport(socket); return(trans); } else { return(socket); } } catch (Exception ex) { throw new TTransportException(ex.ToString(), ex); } }
/// <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, this.clientCertValidator, this.localCertificateSelectionCallback, this.sslProtocols); socket.setupTLS(); if (useBufferedSockets) { TBufferedTransport trans = new TBufferedTransport(socket); return trans; } else { return socket; } } catch (Exception ex) { throw new TTransportException(ex.ToString()); } }