public override void Listen(string host, int port, Action <Socket> callback) { if (callback == null) { throw new ArgumentNullException("callback"); } if (state != Socket.SocketState.Invalid) { throw new InvalidOperationException("Socket already in use"); } this.acceptCallback = callback; int error; int fd = manos_tls_listen(tlsContext, host, port, 128, out error); if (fd < 0) { if (error == 98) { throw new Exception(String.Format("Address {0}::{1} is already in use.", host, port)); } throw new Exception(String.Format("An error occurred while trying to liste to {0}:{1} errno: {2}", host, port, error)); } state = Socket.SocketState.Listening; stream = new SecureSocketStream(this, new IntPtr(fd), tlsContext); stream.ResumeReading(); }
SecureSocket(Context context, SocketInfo info, IntPtr tlsContext) : base(context, info) { stream = new SecureSocketStream(this, new IntPtr(info.fd), tlsContext); this.tlsContext = tlsContext; this.state = Socket.SocketState.Open; }
SecureSocket(IOLoop loop, SocketInfo info, IntPtr tlsContext) : base(loop, info) { stream = new SecureSocketStream (this, new IntPtr (info.fd), tlsContext); this.tlsContext = tlsContext; this.state = Socket.SocketState.Open; }
public override void Close() { if (stream != null) { stream.Close (); stream = null; } base.Close (); }
public override void Close() { if (stream != null) { stream.Close(); stream = null; } base.Close(); }
protected override void AcceptConnections() { int error = 0; while (error == 0) { IntPtr client; SocketInfo accept_info; error = manos_tls_accept(tls, out client, out accept_info); if (error == 0) { var clientStream = new SecureSocketStream(client, accept_info, EVIOLoop); OnConnectionAccepted(clientStream); } } }
public override void Listen(string host, int port, Action<Socket> callback) { if (callback == null) throw new ArgumentNullException ("callback"); if (state != Socket.SocketState.Invalid) throw new InvalidOperationException ("Socket already in use"); this.acceptCallback = callback; int error; int fd = manos_tls_listen (tlsContext, host, port, 128, out error); if (fd < 0) { if (error == 98) throw new Exception (String.Format ("Address {0}::{1} is already in use.", host, port)); throw new Exception (String.Format ("An error occurred while trying to liste to {0}:{1} errno: {2}", host, port, error)); } state = Socket.SocketState.Listening; stream = new SecureSocketStream (this, new IntPtr (fd), tlsContext); stream.ResumeReading (); }
protected override void AcceptConnections() { int error = 0; while (error == 0) { IntPtr client; SocketInfo accept_info; error = manos_tls_accept (tls, out client, out accept_info); if (error == 0) { var clientStream = new SecureSocketStream (client, accept_info, EVIOLoop); OnConnectionAccepted (clientStream); } } }