Package lyntin :: Module net :: Class SocketCommunicator
[show private | hide private]
[frames | no frames]

Class SocketCommunicator


The SocketCommunicator handles all incoming and outgoing data from and to the mud, telnet control codes, and some data transformations.
Method Summary
  __init__(self, e, ses, host, port)
  __repr__(self)
  connect(self, host, port, sessionname)
Takes in a host and a port and connects the socket.
  handleData(self, data)
Handles incoming data from the mud.
string handleNego(self, data)
Removes telnet negotiation stuff from the stream and handles it.
  logControl(self, str)
  run(self)
While the connection hasn't been shut down, we spin through this loop retrieving data from the mud,
  setSessionName(self, name)
Sets the session name.
  shutdown(self)
Shuts down the thread polling the socket connection and the socket as well.
  write(self, data, convert)
Writes data to the mud after passing it through net_write_data_filter.

Method Details

connect(self, host, port, sessionname)

Takes in a host and a port and connects the socket.
Parameters:
host - the host to connect to
           (type=string)
port - the port to connect at
           (type=int)
sessionname - the name of the new session
           (type=string)

handleData(self, data)

Handles incoming data from the mud. We wrap it in a MudEvent and toss it on the queue.
Parameters:
data - the incoming data from the mud
           (type=string)

handleNego(self, data)

Removes telnet negotiation stuff from the stream and handles it.
Parameters:
data - the incoming data from the mud that we need to parse for telnet control code stuff
           (type=string)
Returns:
the data without the telnet control codes
           (type=string)

run(self)

While the connection hasn't been shut down, we spin through this loop retrieving data from the mud,

setSessionName(self, name)

Sets the session name.
Parameters:
name - the new session name
           (type=string)

shutdown(self)

Shuts down the thread polling the socket connection and the socket as well.

write(self, data, convert=1)

Writes data to the mud after passing it through net_write_data_filter.
Parameters:
data - the data to write to the socket
           (type=string)
convert - whether (1) or not (0) we should convert eol stuff to CRLF and IAC to IAC IAC.
           (type=boolean)
Raises:
Exception - if we have problems sending the data over the socket

Generated by Epydoc 2.1 on Mon Aug 9 09:17:42 2004 http://epydoc.sf.net