About: Python client code   Sponge Permalink

An Entity of Type : owl:Thing, within Data Space : dbkwik.org associated with source dataset(s)

The following Python (v2.5) code will allow you to send and receive from UglyMUG or other UglyCODE based MUDs. It assumes that soon after connection you send @terminal commandinfo = on It doesn't deal with logging on itself, and it doesn't use the Telnet Options.

AttributesValues
rdfs:label
  • Python client code
rdfs:comment
  • The following Python (v2.5) code will allow you to send and receive from UglyMUG or other UglyCODE based MUDs. It assumes that soon after connection you send @terminal commandinfo = on It doesn't deal with logging on itself, and it doesn't use the Telnet Options.
dcterms:subject
abstract
  • The following Python (v2.5) code will allow you to send and receive from UglyMUG or other UglyCODE based MUDs. It assumes that soon after connection you send @terminal commandinfo = on It doesn't deal with logging on itself, and it doesn't use the Telnet Options. import re import telnetlib import codecs import socket class uglymugsocket: def __init__(self, server, port): self.abort=1 self.server=server self.port=port self.encoder=codecs.getencoder('utf_8') def connect(self): self.sock=telnetlib.Telnet(self.server, self.port) self.buffer='' self.abort=0 def sendline(self, line): (line, amount) = self.encoder(line + ' ') self.sock.write(line) def sendlineescaped(self, line): line = line.replace("\\", "\\\\").replace("$", "\\$").replace("{", "\\{") self.sendline(line) def readline(self): try: retval = self.sock.read_until(' ', 300).replace(' ', '') except EOFError: self.abort=1 return '' except socket.error: self.abort=1 return '' return retval.replace('', '') class linehandler: def __init__(self): self.lineregexp='\x01\\(([^\x02]*)\\)\x02\\((#-1|#[0-9]+)\\)\x03(.*)' self.commandmatch=re.compile(self.lineregexp, re.DOTALL) self.who='' self.command='' self.text='' def decode(self, x): params = self.commandmatch.findall(x) if len(params) > 0: (self.command, self.who, self.text) = params[0] else: self.text=x
Alternative Linked Data Views: ODE     Raw Data in: CXML | CSV | RDF ( N-Triples N3/Turtle JSON XML ) | OData ( Atom JSON ) | Microdata ( JSON HTML) | JSON-LD    About   
This material is Open Knowledge   W3C Semantic Web Technology [RDF Data] Valid XHTML + RDFa
OpenLink Virtuoso version 07.20.3217, on Linux (x86_64-pc-linux-gnu), Standard Edition
Data on this page belongs to its respective rights holders.
Virtuoso Faceted Browser Copyright © 2009-2012 OpenLink Software