Represents a communiation tunnel between two parties.
Members:
Adds a request to the queue of requests waiting for response.
Close the connection and the socket.
Given a JSON item received from socket, determine its type and process the message.
If threaded mode is activated, this function creates a new thread per each item received and returns without blocking.
Calls read_and_dispatch method until there are no more messages to dispatch in the buffer.
Returns the number of operations that succeded.
This method will never block waiting. If there aren’t any more messages that can be processed, it returns.
Helper function to convert classes and functions to JSON objects.
Given a incompatible object called obj, dump_object returns a JSON hinted object that represents the original parameter.
Parameters:
Retrieves a new ID counter. Each connection has a exclusive ID counter.
It is mainly used to create internal id’s for calls.
Get the maximum timeout in seconds for operation operation.
Parameters:
Helper function for JSON loads. Given a dictionary (javascript object) returns an apropiate object (a specific class) in certain cases.
It is mainly used to convert JSON hinted classes back to real classes.
Parameters:
Call method on server.
Standard function to read from the socket which by default points to read_line
Read one message from socket (with timeout specified by the optional argument timeout) and dispatches that message.
Parameters:
Read a line of data from socket. It removes the n at the end before returning the value.
If the original packet contained n, the message will be decoded as two or more messages.
Returns the line of data received from the socket.
Basic function to put the connection serving. Usually is better to use server.Server class to do this, but this would be useful too if it is run from a separate Thread.
Set the maximum timeout in seconds for operation operation.
Parameters:
configures a timeout for the connection for a given operation. operation is one of “read” or “write”
public property that holds the internal socket used.
Write a line data to socket. It appends a newline at the end of the data before sending it.
The string MUST NOT contain newline otherwise an AssertionError will raise.
Parameters:
Standard function to write to the socket which by default points to write_line
Represents a object in the server-side (or client-side when speaking from the point of view of the server) . It remembers its name in the server-side to allow calls to the original object.
Parameters:
Example:
list = conn.call.newList()
for i in range(10): list.notify.add(i)
print list.call.getitems()
Attributes:
Closes/deletes the remote object. The server may or may not delete it at this time, but after this call we don’t longer have any access to it.
This method is automatically called when Python deletes this instance.
Public property to get the internal connection object.