socket programming

Ajay abra9823 at mail.usyd.edu.au
Wed Sep 15 12:49:13 EDT 2004


hi!

on my client side, i have a socket that sends and then receives
the code is
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((PDA_ADDRESS, PDA_PORT))
s.send("persona=")
s.send(persona)
s.send("\n")
str = s.recv(1024)
data=""
while len(str) != 0:
	data += str
	str = s.recv(1024)
print data

on my server side i create the serversocket, listen, get the client socket
and the client socket receives the data as follows
(clientsocket, address) = serversocket.accept()
str = clientsocket.recv(256)
data=""
while len(str) != 0:
	data += str
	str = clientsocket.recv(256)

the problem is when my client finished sending and waits to receive, on the
server side, it still stays in the while loop waiting to receive more data.

how do i stop that?

thanks






----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



More information about the Python-list mailing list