All pastes #345806 Raw Edit

Untitled

public text v1 · immutable
·published 2007-02-08 21:22 UTC
rendered paste body
#-*-coding:UTF8-*-

from socket import *
hostname= gethostbyname(gethostname())
fileport= 2119
chatport= 2118
buffersize=2048
chataddr=(hostname,chatport)
fileaddr=(hostname,fileport)

fs=socket(AF_INET,SOCK_STREAM)
cs=socket(AF_INET,SOCK_STREAM)
fs.bind(fileaddr)
cs.bind(chataddr)
fs.listen(1)
cs.listen(1)

def chatListener():
    While cs:
        data    = cs.recv(buffersize)
        sendToCsBuffer(data)
    cs.close()

def sendToCsBuffer(data):
    return data