| |
- io.reactor.Address
-
- io.reactor.INETAddress
- io.reactor.UNIXAddress
- io.reactor.PollDispatcher
- io.reactor.Reactable
-
- io.reactor.Socket
-
- io.reactor.ConnectionSocket
- io.reactor.ListenerSocket
class Address |
|
Abstract base class for addresses. |
|
Methods defined here:
- asBindArg(self)
- Returns the address in a form suitable for use in the socket bind()
or connect() calls.
- getConnectedAddress(self, addr)
- Returns a new @Address derivative instance for the given low-level
address (as returned from the accept() call).
- getProtoFamily(self)
- Returns the protocol family constant for the address (the first
argument to a socket() call)
|
class ConnectionSocket(Socket) |
|
Socket used for sending and receiving data.
This is an abstract class, and must be implemented by derived classes.
Derived classes must respect the state of the connected instance
variable. They should not attempt any reads or writes, or return true
from @wantsToRead(), until "connected" becomes true. Furthermore,
@wantsToRead() must always return true until connected, and
@handleWrite() must set connected to true. This behavior is
implemented in the base class methods.
Public-vars:
connected::
[boolean] true if the socket is currently connected. |
|
- Method resolution order:
- ConnectionSocket
- Socket
- Reactable
Methods defined here:
- __init__(self, sock=None, addr=None)
- handleWrite(self, dispatcher)
- Implements @Reactable.handleWrite() so that we can determine when
we become connected.
Derived classes may override, but they must always call the base
class implementation when the connected instance variable is false.
- wantsToWrite(self)
- Implements @Reactable.wantsToWrite() so that we can determine when we
become connected.
Derived classes may override, but they must always return True when
the connected instance variable is false.
Methods inherited from Socket:
- fileno(self)
Methods inherited from Reactable:
- handleDisconnect(self, dispatcher)
- Called when a disconnect occurs.
- handleError(self, dispatcher)
- Called when there is an error.
- handleRead(self, dispatcher)
- Called when the connection is ready to read.
- wantsToRead(self)
- Returns true if the connection should be checked for readability
|
Dispatcher = class PollDispatcher |
|
Reactor implementation based on the poll() function. |
|
Methods defined here:
- __init__(self)
- addReactable(self, obj)
- Adds a new reactable to the set of managed objects.
parms:
obj::
[Reactable]
- hasReactables(self)
- Returns true if the dispatcher has reactables.
- processOneEvent(self)
- removeReactable(self, object)
- run(self)
- schedule(self, when, action)
- Schedules an action to be performed at a particular time.
parms:
when: [float] Time measured in seconds from now. If this is
negative or zero, the action will be performed the next time we
get an event.
action: [callable<>] Action to be performed.
|
class PollDispatcher |
|
Reactor implementation based on the poll() function. |
|
Methods defined here:
- __init__(self)
- addReactable(self, obj)
- Adds a new reactable to the set of managed objects.
parms:
obj::
[Reactable]
- hasReactables(self)
- Returns true if the dispatcher has reactables.
- processOneEvent(self)
- removeReactable(self, object)
- run(self)
- schedule(self, when, action)
- Schedules an action to be performed at a particular time.
parms:
when: [float] Time measured in seconds from now. If this is
negative or zero, the action will be performed the next time we
get an event.
action: [callable<>] Action to be performed.
|
class Reactable |
| |
Methods defined here:
- fileno(self)
- Returns the file descriptor.
- handleDisconnect(self, dispatcher)
- Called when a disconnect occurs.
- handleError(self, dispatcher)
- Called when there is an error.
- handleRead(self, dispatcher)
- Called when the connection is ready to read.
- handleWrite(self, dispatcher)
- Called when the connection is ready to write.
- wantsToRead(self)
- Returns true if the connection should be checked for readability
- wantsToWrite(self)
- Returns true if the connection should be checked for writability.
|
class Socket(Reactable) |
|
Base class for socket types. Just manages the handle. |
|
Methods defined here:
- __init__(self, sock)
- fileno(self)
Methods inherited from Reactable:
- handleDisconnect(self, dispatcher)
- Called when a disconnect occurs.
- handleError(self, dispatcher)
- Called when there is an error.
- handleRead(self, dispatcher)
- Called when the connection is ready to read.
- handleWrite(self, dispatcher)
- Called when the connection is ready to write.
- wantsToRead(self)
- Returns true if the connection should be checked for readability
- wantsToWrite(self)
- Returns true if the connection should be checked for writability.
|
|