All pastes #426207 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-04-05 23:36 UTC
rendered paste body
import socket
import sys

socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

host = ""
port = 20000

socket.bind((host, port))
socket.listen(1)

clientsocket, clientaddress = socket.accept()
print clientaddress
while True:
    y = 0
    if y < 5:
        data = clientsocket.recv(1024)
    if data == False:
        break

data = 2 * data
while True:
    z = 0
    if z < 5:
        clientsocket.send(data)
    if data == False:
        clientsocket.close()