Free Advertising Forums | Free Advertising Board | Post Free Ads Forum | Free Advertising Forums Directory | Best Free Advertising Methods | Advertising Forums

Free Advertising Forums | Free Advertising Board | Post Free Ads Forum | Free Advertising Forums Directory | Best Free Advertising Methods | Advertising Forums (http://www.freeadvertisingzone.com/index.php)
-   Guest Books Directory (http://www.freeadvertisingzone.com/forumdisplay.php?f=59)
-   -   multi-threaded socket python (http://www.freeadvertisingzone.com/showthread.php?t=1221781)

05-18-2011 03:02 PM

multi-threaded socket python
 
network.py file ,GHD Straighteners NZ

# encoding = utf-8 import socket import SocketServer
def hear (port,GHD Rare Straighteners, fn): class MyHandler (SocketServer.BaseRequestHandler): def handle (self): ; fn (ego.request) def finish (self) : self.request.near () myServer = SocketServer.ThreadingTCPServer (('',GHD MK4 Pure Straighteners, port), MyHandler) myServer.serve_forever ()
def connect (ip,GHD Precious Gift Set, port, timeout = 3): sock = socket.socket (socket.AF_INET,GHD MK4 Kiss Straighteners, socket.SOCK_STREAM) sock.settimeout (timeout ) sock.join ((ip,GHD Hair Straightener, wharf)) return sock
whether (__name__ =='__ main__'):
def transact (sock): msg = ; While True: buf = sock.recv (5) msg + = buf if (len (buf) <5): sock.send (if not buf: break print msg return ; listen (41234, transact)

consumer test program :

# encoding = utf-8
import network
client = network.connect (


All times are GMT. The time now is 05:14 PM.

Powered by vBulletin Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Free Advertising Forums | Free Advertising Message Boards | Post Free Ads Forum