Module antiparser :: Class apSocket
[frames | no frames]

Class apSocket


apSocket is a wrapper class for the Python socket API, for specialized use with the antiparser.

apSocket provides much of the same functionality of the Python socket API, but is implemented as a series of shortcuts for using the sockets interface. When apSocket is instantiated, it implicitly creates a socket of the specified type.
Method Summary
  __init__(self, type)
Initializes a socket of the specified type, either 'udp' or 'tcp'.
  close(self)
Alias for socket.close method.
  connect(self, host, port)
Alias for the socket.connect method, forming a TCP connection to host/port.
  recv(self, size)
Alias for the socket.recv method, blocks until the number of bytes specified by size is read from the socket.
  replayTCP(self, fileName)
Sends a permutation of the antiparser that was previously saved over TCP, as specified by fileName.
  replayUDP(self, fileName, host, port)
Sends a permutation of the antiparser that was previously saved over UDP, as specified by fileName.
  sendTCP(self, payload)
Alias for the socket.sendall method, will send the entire payload over the socket.
  sendUDP(self, payload, host, port)
Alias for the socket.sendto method.
  sleep(self, secs)
Alias for time.sleep, sleeps for the number of seconds specified by the secs argument.

Method Details

__init__(self, type='tcp')
(Constructor)

Initializes a socket of the specified type, either 'udp' or 'tcp'.

__init__ will create a socket which persists until closed using the close(). If no type argument is specified, than the default type is 'tcp'.

close(self)

Alias for socket.close method. This closes the existing socket.

connect(self, host, port)

Alias for the socket.connect method, forming a TCP connection to host/port.

This method is called prior to sendTCP, but not sendUDP, since UDP is a connectionless protocol.

recv(self, size)

Alias for the socket.recv method, blocks until the number of bytes specified by size is read from the socket.

replayTCP(self, fileName)

Sends a permutation of the antiparser that was previously saved over TCP, as specified by fileName.

replayTCP calls antiparser.load(fileName) internally. replay also assumes an existing apSocket instance. The method will then send the antiparser permutation to the existing TCP socket.

replayUDP(self, fileName, host, port)

Sends a permutation of the antiparser that was previously saved over UDP, as specified by fileName.

replayUDP calls antiparser.load(fileName) internally. replay also assumes an existing apSocket instance. The method will then send the antiparser permutation to the existing UDP socket.

sendTCP(self, payload)

Alias for the socket.sendall method, will send the entire payload over the socket.

sendUDP(self, payload, host, port)

Alias for the socket.sendto method.

sendUDP will send packets to host, port until all bytes in payload are sent.

sleep(self, secs)

Alias for time.sleep, sleeps for the number of seconds specified by the secs argument.

Generated by Epydoc 2.1 on Wed Aug 17 09:02:50 2005 http://epydoc.sf.net
SourceForge.net Logo