Module pyinsim :: Class _OutSocket
[hide private]
[frames] | no frames]

Class _OutSocket

source code

Known Subclasses:

Class to manage UDP connections, such as OutGauge and OutSim.

This is an abstract method, don't use it directly. See OutGauge and OutSim to see how to inherit from it.

Instance Methods [hide private]
 
__init__(self, timeout, name)
Init the _OutSocket.
source code
 
isConnected(self)
Get if the socket is connected.
source code
 
name(self)
Get the name of the connection.
source code
 
connect(self, host, port)
Connect to the specified host and port and begin the packet listener thread.
source code
 
close(self)
Close the connection.
source code
 
__receiveThread(self)
UDP receive thread.
source code
 
__raisePacketEvent(self, data)
Raise a packet event.
source code
 
_getPacket(self, data)
Virtual method to get the correct packet.
source code
 
run(self)
Blocks the calling thread until pyinsim's internal receive thread has ended.
source code
 
bind(self, callback)
Bind a packet callback event handler.
source code
 
unbind(self, callback)
Unbind a packet callback event handler.
source code
 
isBound(self, callback)
Check if an event-handler has been bound.
source code
 
__raiseErrorEvent(self, err)
Raises a thread error event.
source code
 
bindError(self, callback)
Bind a event-handler to be called if the internal receive thread encounters an error.
source code
 
__raiseTimeoutEvent(self, timeout)
Raise timeout event.
source code
 
bindTimeout(self, callback)
Bind a event-handler to be called if the connection times out.
source code
 
_OutSocket__raiseErrorEvent(self, err)
Raises a thread error event.
source code
 
_OutSocket__raisePacketEvent(self, data)
Raise a packet event.
source code
 
_OutSocket__raiseTimeoutEvent(self, timeout)
Raise timeout event.
source code
 
_OutSocket__receiveThread(self)
UDP receive thread.
source code
Method Details [hide private]

__init__(self, timeout, name)
(Constructor)

source code 

Init the _OutSocket.

Args:
timeout - The time to wait for a packet to arrive before timing out. name - An optinal name for the connection.

isConnected(self)

source code 

Get if the socket is connected.

Returns:
True if the socket is connected.

name(self)

source code 

Get the name of the connection.

Returns:
The name.

connect(self, host, port)

source code 

Connect to the specified host and port and begin the packet listener thread.

Args:
host - The host to connect to. port - The port to connect to the host through.

run(self)

source code 
Blocks the calling thread until pyinsim's internal receive thread has ended. This usful for stopping a console application from closing while the connection is still active.

bind(self, callback)

source code 

Bind a packet callback event handler.

Args:
The function or method to call once a packet has been received.

unbind(self, callback)

source code 

Unbind a packet callback event handler.

Args:
The function or method to remove.

isBound(self, callback)

source code 

Check if an event-handler has been bound.

Args:
callback - The function to check.

bindError(self, callback)

source code 

Bind a event-handler to be called if the internal receive thread encounters an error.

Args:
callback - The function to call.

bindTimeout(self, callback)

source code 

Bind a event-handler to be called if the connection times out.

Args:
callback - The function to call.