Created
February 27, 2011 21:00
-
-
Save bdrewery/846532 to your computer and use it in GitHub Desktop.
Hacked this up for cutie578's ident
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# Mostly copied from http://docs.python.org/library/socketserver.html | |
import SocketServer, socket | |
class MyTCPHandler(SocketServer.BaseRequestHandler): | |
def handle(self): | |
self.data = self.rfile.readline().strip() | |
print "Received from %s: %s" % (self.client_address[0], self.data) | |
self.request.send(self.data + ":USERID:UNIX:cutie578\r\n") | |
class TCP6Server(SocketServer.TCPServer): | |
address_family = socket.AF_INET6 | |
if __name__ == "__main__": | |
HOST, PORT = "::", 113 | |
server = TCP6Server((HOST, PORT), MyTCPHandler) | |
server.serve_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment