On Mar 11, 9:10 pm, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > On Tue, 11 Mar 2008 08:24:54 -0700 (PDT), asit <[EMAIL PROTECTED]> wrote: > >import socket > >import sys > >import thread > > >p=1 > >PORT=11000 > >BUFSIZE=1024 > > >def getData(cSocket): > > global stdoutlock,cSocketlock > > while True: > > cSocketlock.acquire() > > data=cSocket.recv(BUFSIZE) > > if data=='q': > > data='client exited' > > cSocket.close() > > p=0 > > cSocketlock.release() > > stdoutlock.acquire() > > stdout.write(data) > > stdoutlock.release() > > >def sendData(cSocket): > > global stdoutlock,cSocketlock > > while True: > > stdoutlock.acquire() > > data=raw_input('>>') > > cSocketlock.acquire_lock() > > if data=='q': > > stdout.write('server exited') > > stdout.release() > > p=0 > > cSocket.close() > > sSocket.send(data) > > sSocketlock.release() > > Could it be because `sSocketlock´ here > > > > >stdout=sys.stdout > >host='' > >sSocket=socket.socket(socket.AF_INET,socket.SOCK_STREAM) > >sSocket.bind((host,PORT,)) > >sSocket.listen(1) > >#sSocketlock=thread.allocate_lock() > > is never bound since the line above here is commented out? > > >stdoutlock=thread.allocate_lock() > >print 'waiting for connection' > >cSocket,addr=sSocket.accept() > >print 'connection from',addr > >cSocketlock=thread.allocate_lock() > >thread.start_new_thread(sendData,(cSocket,)) > >thread.start_new_thread(getData,(cSocket,)) > >if p==0: > > sSocket.close() > > >In the above program, why there is an unhandeled exception ??? > > Just a guess. You should really include the traceback when you ask a > question like this. > > Jean-Paul
It's not a traceback error. It's an unhandeled exception..please help -- http://mail.python.org/mailman/listinfo/python-list