Package twisted :: Package internet :: Module udp :: Class Port

[show private | hide private]
[frames | no frames]

## Class Port

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

Known Subclasses:
  `MulticastPort`, `ConnectedPort`

UDP port, listening for packets.

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

Class Variable Summary
`tuple` | `__implements__`
`int` | `addressFamily`
`int` | `socketType`

Method Details

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

Initialize with a numeric port to listen on.

### connectionLost(self, reason=None)

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.

This will shut down my socket and call self.connectionLost().

### 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.

### stopListening(self)

Stop accepting connections on this port.

This will shut down my socket and call self.connectionLost().

### write(self, datagram, (host,

Write a datagram.

Class Variable Details

### __implements__

  Type:
    `tuple`
  Value:

        ((<class twisted.internet.interfaces.IProducer at 0x81d489c>,
          <class twisted.internet.interfaces.IReadWriteDescriptor at 0x81d45dc\
        >,
          <class twisted.internet.interfaces.IConsumer at 0x81d4704>,
          <class twisted.internet.interfaces.ITransport at 0x81d4bcc>),
         <class twisted.internet.interfaces.IUDPTransport at 0x81d532c>)

### addressFamily

  Type:
    `int`
  Value:

        2

### socketType

  Type:
    `int`
  Value:

        2

Generated by Epydoc 1.1 on Sat Feb 15 21:19:06 2003 | http://epydoc.sf.net