Package twisted :: Package internet :: Module udp :: Class Port
[frames | no frames]

Class Port

 Ephemeral --+        
             |        
    Logger --+        
             |        
FileDescriptor --+    
                 |    
          BasePort --+
                     |
                    Port

Known Subclasses:
ConnectedPort, DatagramPort, MulticastPort

UDP port, listening for packets.
Method Summary
  __init__(self, port, proto, interface, maxPacketSize, reactor)
Initialize with a numeric port to listen on.
  __repr__(self)
  _bindSocket(self)
  _connectToProtocol(self)
  connect(self, host, port)
'Connect' to remote server.
  connectionLost(self, reason)
Cleans up my socket.
  doRead(self)
Called when my socket is ready for reading.
  getHandle(self)
Return a socket object.
  getHost(self)
Returns an IPv4Address.
  logPrefix(self)
Returns the name of my class, to prefix log entries with.
  loseConnection(self)
Stop accepting connections on this port.
  setLogStr(self)
  startListening(self)
Create and bind my socket, and begin listening on it.
  stopListening(self)
  write(self, datagram, addr)
Write a datagram.
  writeSequence(self, seq, addr)
    Inherited from BasePort
  createInternetSocket(self)
  doWrite(self)
Raises a RuntimeError
    Inherited from FileDescriptor
  _postLoseConnection(self)
Called after a loseConnection(), when all data has been written.
  fileno(self)
File Descriptor number for select().
  pauseProducing(self)
  registerProducer(self, producer, streaming)
Register to receive data from a producer.
  resumeProducing(self)
  startReading(self)
Start waiting for read availability.
  startWriting(self)
Start waiting for write availability.
  stopConsuming(self)
Stop consuming data.
  stopProducing(self)
  stopReading(self)
Stop waiting for read availability.
  stopWriting(self)
Stop waiting for write availability.
  unregisterProducer(self)
Stop consuming data from a producer, without disconnecting.
  writeSomeData(self, data)
Write as much as possible of the given data, immediately.
    Inherited from Ephemeral
  __getstate__(self)
  __setstate__(self, state)

Class Variable Summary
tuple __implements__ = ((<class twisted.internet.interfaces.IP...
int addressFamily = 2                                                                     
int maxThroughput = 262144                                                                
int socketType = 2                                                                     
    Inherited from FileDescriptor
int bufferSize = 65536                                                                 
int connected = 0                                                                     
str dataBuffer = ''
int disconnected = 0                                                                     
int disconnecting = 0                                                                     
int offset = 0                                                                     
NoneType producer = None                                                                  
int producerPaused = 0                                                                     
int streamingProducer = 0                                                                     

Method Details

__init__(self, port, proto, interface='', maxPacketSize=8192, reactor=None)
(Constructor)

Initialize with a numeric port to listen on.
Overrides:
twisted.internet.abstract.FileDescriptor.__init__

connect(self, host, port)

'Connect' to remote server.

connectionLost(self, reason=None)

Cleans up my socket.
Overrides:
twisted.internet.abstract.FileDescriptor.connectionLost

doRead(self)

Called when my socket is ready for reading.

getHandle(self)

Return a socket object.

getHost(self)

Returns an IPv4Address.

This indicates the address from which I am connecting.

logPrefix(self)

Returns the name of my class, to prefix log entries with.
Overrides:
twisted.python.log.Logger.logPrefix

loseConnection(self)

Stop accepting connections on this port.

This will shut down my socket and call self.connectionLost().
Overrides:
twisted.internet.abstract.FileDescriptor.loseConnection

startListening(self)

Create and bind my socket, and begin listening on it.

This is called on unserialization, and must be called after creating a server to begin listening on the specified port.

write(self, datagram, addr=None)

Write a datagram.
Parameters:
addr - should be a tuple (ip, port), can be None in connected mode.
Overrides:
twisted.internet.abstract.FileDescriptor.write

Class Variable Details

__implements__

Type:
tuple
Value:
((<class twisted.internet.interfaces.IProducer at 0x827b064>,
  <class twisted.internet.interfaces.IReadWriteDescriptor at 0x827d20c\
>,
  <class twisted.internet.interfaces.IConsumer at 0x824feb4>,
  <class twisted.internet.interfaces.ITransport at 0x8254024>),
 <class twisted.internet.interfaces.IUDPTransport at 0x81cba5c>,
 <class twisted.internet.interfaces.ISystemHandle at 0x827cf14>)       

addressFamily

Type:
int
Value:
2                                                                     

maxThroughput

Type:
int
Value:
262144                                                                

socketType

Type:
int
Value:
2                                                                     

Generated by Epydoc 2.0 on Sat May 15 20:07:41 2004 http://epydoc.sf.net