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)
  connectionLost(self, reason)
Cleans up my socket.
  doRead(self)
Called when my socket is ready for reading.
  getHost(self)
Returns a tuple of ('INET_UDP', hostname, port), indicating the servers address
  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__

connectionLost(self, reason=None)

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

doRead(self)

Called when my socket is ready for reading.

getHost(self)

Returns a tuple of ('INET_UDP', hostname, port), indicating the servers address

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)

Write a datagram.
Parameters:
addr - should be a tuple (host, port)
Overrides:
twisted.internet.abstract.FileDescriptor.write

Class Variable Details

__implements__

Type:
tuple
Value:
((<class twisted.internet.interfaces.IProducer at 0x825fae4>,
  <class twisted.internet.interfaces.IReadWriteDescriptor at 0x825009c\
>,
  <class twisted.internet.interfaces.IConsumer at 0x8250c4c>,
  <class twisted.internet.interfaces.ITransport at 0x82500ec>),
 <class twisted.internet.interfaces.IUDPTransport at 0x829361c>)       

addressFamily

Type:
int
Value:
2                                                                     

maxThroughput

Type:
int
Value:
262144                                                                

socketType

Type:
int
Value:
2                                                                     

Generated by Epydoc 2.0 on Tue Dec 9 17:48:16 2003 http://epydoc.sf.net