class Port(abstract.FileHandle): (source)
Known subclasses: twisted.internet.iocpreactor.udp.MulticastPort
Constructor: Port(port, proto, interface, maxPacketSize, ...)
Implements interfaces: twisted.internet.interfaces.IListeningPort
, twisted.internet.interfaces.ISystemHandle
, twisted.internet.interfaces.IUDPTransport
, twisted.internet.iocpreactor.interfaces.IReadWriteHandle
UDP port, listening for packets.
Method | __init__ |
Initialize with a numeric port to listen on. |
Method | __repr__ |
Undocumented |
Method | cb |
Undocumented |
Method | connect |
'Connect' to remote server. |
Method | connection |
Cleans up my socket. |
Method | create |
Undocumented |
Method | do |
Undocumented |
Method | get |
Checks if broadcast is currently allowed on this port. |
Method | get |
Return a socket object. |
Method | get |
Return the local address of the UDP connection |
Method | handle |
Undocumented |
Method | log |
Returns the name of my class, to prefix log entries with. |
Method | lose |
Close the connection at the next available opportunity. |
Method | set |
Set whether this port may broadcast. This is disabled by default. |
Method | set |
Initialize the logstr attribute to be used by logPrefix. |
Method | start |
Create and bind my socket, and begin listening on it. |
Method | stop |
Stop listening on this port. |
Method | write |
Write a datagram. |
Method | write |
Write an iterable of byte strings to the physical connection. |
Class Variable | dynamic |
Undocumented |
Instance Variable | address |
Undocumented |
Instance Variable | address |
socket.AF_INET or socket.AF_INET6 , depending on whether this port is listening on an IPv4 address or an IPv6 address. |
Instance Variable | address |
Undocumented |
Instance Variable | connected |
Undocumented |
Instance Variable | d |
Undocumented |
Instance Variable | interface |
Undocumented |
Instance Variable | logstr |
Undocumented |
Instance Variable | port |
Undocumented |
Instance Variable | protocol |
Undocumented |
Instance Variable | reactor |
Undocumented |
Instance Variable | read |
Undocumented |
Instance Variable | socket |
Undocumented |
Method | _bind |
Undocumented |
Method | _connect |
Undocumented |
Method | _lose |
Undocumented |
Method | _set |
Resolve address family for the socket. |
Instance Variable | _connected |
Undocumented |
Instance Variable | _real |
Undocumented |
Inherited from FileHandle
:
Method | data |
Undocumented |
Method | do |
Undocumented |
Method | get |
Undocumented |
Method | get |
Get the remote address of this connection. |
Method | lose |
Undocumented |
Method | pause |
Pause producing data. |
Method | read |
Indicates read connection was lost. |
Method | read |
Undocumented |
Method | resume |
Resume producing data. |
Method | start |
Undocumented |
Method | start |
Override in a subclass to cause the reactor to monitor this selectable for write events. This will be called once in unregisterProducer if loseConnection has previously been called, so that the connection can actually close. |
Method | stop |
Stop consuming data. |
Method | stop |
Stop producing data. |
Method | stop |
Undocumented |
Method | stop |
Undocumented |
Method | write |
Indicates write connection was lost. |
Method | write |
Undocumented |
Constant | SEND |
Undocumented |
Class Variable | disconnecting |
Undocumented |
Class Variable | max |
Undocumented |
Class Variable | write |
Undocumented |
Instance Variable | data |
Undocumented |
Instance Variable | disconnected |
Undocumented |
Instance Variable | offset |
Undocumented |
Instance Variable | producer |
Undocumented |
Instance Variable | producer |
Undocumented |
Instance Variable | reading |
Undocumented |
Instance Variable | writing |
Undocumented |
Method | _cb |
Undocumented |
Method | _cb |
Undocumented |
Method | _close |
Undocumented |
Method | _dispatch |
Dispatch previously read data. Return True if self.reading and we don't have any more data |
Method | _handle |
Returns False if we should stop reading for now |
Method | _handle |
Returns false if we should stop writing for now |
Method | _resume |
Undocumented |
Method | _resume |
Undocumented |
Class Variable | _write |
Undocumented |
Instance Variable | _read |
Undocumented |
Instance Variable | _read |
Undocumented |
Instance Variable | _read |
Undocumented |
Instance Variable | _read |
Undocumented |
Instance Variable | _read |
Undocumented |
Instance Variable | _temp |
Undocumented |
Instance Variable | _temp |
Undocumented |
Instance Variable | _write |
Undocumented |
Instance Variable | _write |
Undocumented |
Inherited from _ConsumerMixin
(via FileHandle
):
Method | register |
Register to receive data from a producer. |
Method | unregister |
Stop consuming data from a producer, without disconnecting. |
Instance Variable | streaming |
bool or int |
Inherited from _LogOwner
(via FileHandle
, _ConsumerMixin
):
Method | _get |
Determine the log prefix to use for messages related to applicationObject, which may or may not be an interfaces.ILoggingContext provider. |
int
, proto: AbstractDatagramProtocol
, interface: str
= '', maxPacketSize: int
= 8192, reactor: IOCPReactor | None
= None):
(source)
¶
twisted.internet.iocpreactor.udp.MulticastPort
Initialize with a numeric port to listen on.
Return the local address of the UDP connection
Returns | |
IPv4Address or IPv6Address | the local address of the UDP connection |
Close the connection at the next available opportunity.
Call this to cause this FileDescriptor to lose its connection. It will first write any data that it has buffered.
If there is data buffered yet to be written, this method will cause the transport to lose its connection as soon as it's done flushing its write buffer. If you have a producer registered, the connection won't be closed until the producer is finished. Therefore, make sure you unregister your producer when it's finished, or the connection will never close.
Set whether this port may broadcast. This is disabled by default.
Parameters | |
enabled:bool | Whether the port may broadcast. |
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.
Stop listening on this port.
If it does not complete immediately, will return Deferred that fires upon completion.
Write a datagram.
Parameters | |
datagram | Undocumented |
addr | should be a tuple (ip, port), can be None in connected mode. |
Write an iterable of byte strings to the physical connection.
If possible, make sure that all of the data is written to the socket at once, without first copying it all into a single byte string.
Parameters | |
seq | Undocumented |
addr | Undocumented |
data | The data to write. |
socket.AF_INET
or socket.AF_INET6
, depending on whether this port is listening on an IPv4 address or an IPv6 address.