Inheritance: TCPSocket
Beispiel #1
0
        public static TCPServer/*!*/ Reinitialize(ConversionStorage<MutableString>/*!*/ stringCast, ConversionStorage<int>/*!*/ fixnumCast,
            TCPServer/*!*/ self,
            [DefaultProtocol]MutableString remoteHost, object remotePort,
            [DefaultProtocol]MutableString localHost, object localPort) {

            self.Socket = CreateSocket(remoteHost, ConvertToPortNum(stringCast, fixnumCast, remotePort));
            BindLocalEndPoint(self, localHost, ConvertToPortNum(stringCast, fixnumCast, localPort));
            return self;
        }
Beispiel #2
0
 public static TCPSocket AcceptNonBlocking(RubyContext/*!*/ context, TCPServer/*!*/ self)
 {
     bool blocking = self.Socket.Blocking;
     try {
         self.Socket.Blocking = false;
         return Accept(context, self);
     } finally {
         // Reset the blocking
         self.Socket.Blocking = blocking;
     }
 }
Beispiel #3
0
        public static TCPServer/*!*/ Reinitialize(ConversionStorage<MutableString>/*!*/ stringCast, ConversionStorage<int>/*!*/ fixnumCast,
            TCPServer/*!*/ self, [DefaultProtocol]MutableString remoteHost, object remotePort, [Optional]int localPort) {

            // Not sure what the semantics should be in this case but we make sure not to blow up.
            // Real-world code (Server.connect_to in memcache.rb in the memcache-client gem) does do "TCPSocket.new(host, port, 0)"
            if (localPort != 0) {
                throw new NotImplementedError();
            }

            self.Socket = CreateSocket(remoteHost, ConvertToPortNum(stringCast, fixnumCast, remotePort));
            return self;
        }
Beispiel #4
0
 public static void Listen(TCPServer/*!*/ self, int backlog) {
     self.Socket.Listen(backlog);
 }
Beispiel #5
0
 public static int SysAccept(RubyContext/*!*/ context, TCPServer/*!*/ self) {
     return Accept(context, self).FileDescriptor;
 }
Beispiel #6
0
 public static TCPSocket/*!*/ Accept(RubyContext/*!*/ context, TCPServer/*!*/ self) {
     return new TCPSocket(context, self.Accept());
 }
Beispiel #7
0
 public static TCPServer/*!*/ Reinitialize(ConversionStorage<MutableString>/*!*/ stringCast, ConversionStorage<int>/*!*/ fixnumCast,
     TCPServer/*!*/ self, [DefaultProtocol]MutableString hostname, [DefaultParameterValue(null)]object port) {
     self.Socket = CreateSocket(stringCast, fixnumCast, hostname, port);
     return self;
 }
Beispiel #8
0
 public static void Listen(TCPServer /*!*/ self, int backlog)
 {
     self.Socket.Listen(backlog);
 }
Beispiel #9
0
 public static int SysAccept(RubyContext /*!*/ context, TCPServer /*!*/ self)
 {
     return(Accept(context, self).FileDescriptor);
 }
Beispiel #10
0
 public static TCPSocket /*!*/ Accept(RubyContext /*!*/ context, TCPServer /*!*/ self)
 {
     return(new TCPSocket(context, self.Accept()));
 }
Beispiel #11
0
 public static TCPServer /*!*/ Reinitialize(ConversionStorage <MutableString> /*!*/ stringCast, ConversionStorage <int> /*!*/ fixnumCast,
                                            TCPServer /*!*/ self, [DefaultProtocol] MutableString hostname, [DefaultParameterValue(null)] object port)
 {
     self.Socket = CreateSocket(stringCast, fixnumCast, hostname, port);
     return(self);
 }