Package twisted :: Package internet :: Module protocol :: Class AbstractDatagramProtocol

[frames | no frames]

## Class AbstractDatagramProtocol

Known Subclasses:
  `DatagramProtocol`, `EthernetProtocol`, `IPProtocol`, `RawUDPProtocol`

Abstract protocol for datagram-oriented transports, e.g. IP, ICMP, ARP, UDP.

Method Summary
| `__getstate__(self)`
| ``datagramReceived`(self, datagram, addr)` Called when a datagram is received.
| ``doStart`(self)` Make sure startProtocol is called.
| ``doStop`(self)` Make sure stopProtocol is called.
| ``makeConnection`(self, transport)` Make a connection to a transport and a server.
| ``startProtocol`(self)` Called when a transport is connected to this protocol.
| ``stopProtocol`(self)` Called when the transport is disconnected.

Class Variable Summary
`int` | `noisy` = 1
`int` | `numPorts` = 0
`NoneType` | `transport` = None

Method Details

### datagramReceived(self, datagram, addr)

Called when a datagram is received.

  Parameters:
    `datagram` - the string received from the transport.
    `addr` - tuple of source of datagram.

### doStart(self)

Make sure startProtocol is called.

This will be called by makeConnection(), users should not call it.

### doStop(self)

Make sure stopProtocol is called.

This will be called by the port, users should not call it.

### makeConnection(self, transport)

Make a connection to a transport and a server.

This sets the 'transport' attribute of this DatagramProtocol, and calls the doStart() callback.

### startProtocol(self)

Called when a transport is connected to this protocol.

Will only be called once, even if multiple ports are connected.

### stopProtocol(self)

Called when the transport is disconnected.

Will only be called once, after all ports are disconnected.

Class Variable Details

### noisy

  Type:
    `int`
  Value:

        1

### numPorts

  Type:
    `int`
  Value:

        0

### transport

  Type:
    `NoneType`
  Value:

        None

Generated by Epydoc 2.0 on Sat May 15 20:08:51 2004 | http://epydoc.sf.net