Beispiel #1
0
        public ConnectionProxy OnAccept(Socket socket)
        {
            IntPtr fd = SocketPassing.ReceiveFrom(socket.Handle);

            Logger.Write(LogLevel.Debug, "Received fd {0} from {1}", fd, socket.Handle);
            Socket passed = new UnmanagedSocket(fd, true);

            return(new ConnectionProxy(new Connection(passed, server)));
        }
Beispiel #2
0
 static bool TryCreatePipe(out Socket socket)
 {
     socket = null;
     try {
         socket = new UnmanagedSocket(IntPtr.Zero);
     } catch (System.Net.Sockets.SocketException e) {
         Logger.Write(LogLevel.Error, "Pipe socket is not bound.");
         Logger.Write(e);
         var errorcode = e.SocketErrorCode;
         Logger.Write(LogLevel.Debug, "Errorcode: {0}", errorcode);
         return(false);
     } catch (NotSupportedException) {
         Logger.Write(LogLevel.Error, "Error: Pipe sockets are not supported on this system.");
         return(false);
     }
     return(true);
 }