/ Published in: Python

http://lineguides.netsons.org
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
# -*- coding: UTF-8 -*- import socket def risp(): HOST = '127.0.0.1' PORT = 90007 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((HOST, PORT)) text=raw_input('Client::. \t') if text=='/quit': print 'BYE' s.close() else: s.send(text) data = s.recv(1024) print 'Server::. \t', `data` s.close() risp() risp()
Comments
