Package xmpp :: Module transports :: Class TCPsocket

[hide private]
[frames] | no frames]

# Class TCPsocket

source code

    client.PlugIn --+
                    |
                   TCPsocket

Known Subclasses:
  HTTPPROXYsocket

This class defines direct TCP connection method.

Instance Methods | [hide private]

__init__(self, server=None, use_srv=True) Cache connection point 'server'. | source code

plugin(self, owner) Fire up connection. | source code

getHost(self) Return the 'host' value that is connection is [will be] made to. | source code

getPort(self) Return the 'port' value that is connection is [will be] made to. | source code

connect(self, server=None) Try to connect. | source code

plugout(self) Disconnect from the remote server and unregister self.disconnected method from the owner's dispatcher. | source code

receive(self) Reads all pending incoming data. | source code

send(self, raw_data) Writes raw outgoing data. | source code

pending_data(self, timeout=0) Returns true if there is a data ready to be read. | source code

disconnect(self) Closes the socket. | source code

disconnected(self) Called when a Network Error or disconnection occurs. | source code

Inherited from `client.PlugIn`: `DEBUG`, `PlugIn`, `PlugOut`

Method Details | [hide private]

### __init__(self, server=None, use_srv=True)
(Constructor)

source code

Cache connection point 'server'. 'server' is the tuple of (host, port) absolutely the same as standard tcp socket uses.

Overrides: client.PlugIn.__init__

### plugin(self, owner)

source code

Fire up connection. Return non-empty string on success. Also registers self.disconnected method in the owner's dispatcher. Called internally.

### connect(self, server=None)

source code

Try to connect. Returns non-empty string on success.

### receive(self)

source code

Reads all pending incoming data. In case of disconnection calls owner's disconnected() method and then raises IOError exception.

### send(self, raw_data)

source code

Writes raw outgoing data. Blocks until done. If supplied data is unicode string, encodes it to utf-8 before send.

### disconnected(self)

source code

Called when a Network Error or disconnection occurs. Designed to be overidden.