void HandleAccept() { if (socketInfos == null) { socketInfos = new SocketInfo[100]; } int error; int amount = manos_socket_accept_many(Handle.ToInt32(), socketInfos, socketInfos.Length, out error); if (amount < 0) { throw new Exception(String.Format("Exception while accepting. errno: {0}", error)); } for (int i = 0; i < amount; i++) { var socket = new PlainSocket(parent.Context, socketInfos [i]); parent.acceptCallback(socket); } }
public override void Close() { if (parent == null) { return; } RaiseEndOfStream(); int error; int res = manos_socket_close(Handle.ToInt32(), out error); if (res < 0) { Console.Error.WriteLine("Error '{0}' closing socket: {1}", error, Handle.ToInt32()); Console.Error.WriteLine(Environment.StackTrace); } receiveBuffer = null; socketInfos = null; parent = null; base.Close(); }
void HandleAccept() { if (socketInfos == null) socketInfos = new SocketInfo[100]; int error; int amount = manos_socket_accept_many (Handle.ToInt32 (), socketInfos, socketInfos.Length, out error); if (amount < 0) throw new Exception (String.Format ("Exception while accepting. errno: {0}", error)); for (int i = 0; i < amount; i++) { var socket = new PlainSocket (parent.Context, socketInfos [i]); parent.acceptCallback (socket); } }
public override void Close() { if (parent == null) { return; } RaiseEndOfStream (); int error; int res = manos_socket_close (Handle.ToInt32 (), out error); if (res < 0) { Console.Error.WriteLine ("Error '{0}' closing socket: {1}", error, Handle.ToInt32 ()); Console.Error.WriteLine (Environment.StackTrace); } receiveBuffer = null; socketInfos = null; parent = null; base.Close (); }
public PlainSocketStream(PlainSocket parent, IntPtr handle) : base(parent.Context, handle) { this.parent = parent; }