GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — python_tools/python-chat/client.py at master · albertofwb/python_tools Expand file tree/ Copy pathclient.pyMore file actions executable file ·51 lines (41 loc) · 1021 Bytes / Copy pathclient.pyFile metadata and controlsexecutable file ·51 lines (41 loc) · 1021 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 #! /usr/bin/env python # -*- coding: utf-8 -*- """ Created on Thu Oct 24 17:35:50 2013 @author: zbg """ import socket import threading from config import * inString = '' outString = '' nick = '' def DealOut(s): global nick, outString while True: outString = raw_input() outString = nick + ': ' + outString s.send(outString) def DealIn(s): global inString while True: try: inString = s.recv(1024) if not inString: break if outString != inString: print inString except: break nick = raw_input("input your nickname: ") ip = raw_input("input the server's ip adrress: ") if len(ip) < 1: ip = DEFAULT_IP sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((ip, 8888)) sock.send(nick) thin = threading.Thread(target = DealIn, args = (sock,)) thin.start() thout = threading.Thread(target = DealOut, args = (sock,)) thout.start() #sock.close() |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |