def adoptDatagramPort(self, fileDescriptor, addressFamily, protocol, maxPacketSize=8192): if addressFamily not in (socket.AF_INET, socket.AF_INET6): raise error.UnsupportedAddressFamily(addressFamily) p = udp.Port._fromListeningDescriptor( self, fileDescriptor, addressFamily, protocol, maxPacketSize=maxPacketSize) p.startListening() return p
def adoptStreamConnection(self, fileDescriptor, addressFamily, factory): """ @see: L{twisted.internet.interfaces.IReactorSocket.adoptStreamConnection} """ if addressFamily not in (socket.AF_INET, socket.AF_INET6): raise error.UnsupportedAddressFamily(addressFamily) return tcp.Server._fromConnectedSocket(fileDescriptor, addressFamily, factory, self)
def adoptStreamConnection(self, fileDescriptor, addressFamily, factory): """ @see: L{twisted.internet.interfaces.IReactorSocket.adoptStreamConnection} """ if addressFamily not in self._supportedAddressFamilies: raise error.UnsupportedAddressFamily(addressFamily) if unixEnabled and addressFamily == socket.AF_UNIX: return unix.Server._fromConnectedSocket( fileDescriptor, factory, self) else: return tcp.Server._fromConnectedSocket( fileDescriptor, addressFamily, factory, self)
def adoptStreamPort(self, fileDescriptor, addressFamily, factory): """ Create a new L{IListeningPort} from an already-initialized socket. This just dispatches to a suitable port implementation (eg from L{IReactorTCP}, etc) based on the specified C{addressFamily}. @see: L{twisted.internet.interfaces.IReactorSocket.adoptStreamPort} """ if addressFamily not in (socket.AF_INET, socket.AF_INET6): raise error.UnsupportedAddressFamily(addressFamily) p = tcp.Port._fromListeningDescriptor(self, fileDescriptor, addressFamily, factory) p.startListening() return p