상속: Manos.IO.Libev.EventedSocket
예제 #1
0
            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);
                }
            }
예제 #2
0
            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();
            }
예제 #3
0
            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);
                }
            }
예제 #4
0
            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 ();
            }
예제 #5
0
 public PlainSocketStream(PlainSocket parent, IntPtr handle)
     : base(parent.Context, handle)
 {
     this.parent = parent;
 }
예제 #6
0
 public PlainSocketStream(PlainSocket parent, IntPtr handle)
     : base(parent.Context, handle)
 {
     this.parent = parent;
 }