Tino Dai wrote:
> Hi there,
>
> I am wondering if somebody to could answer a question about
> sockets. I have a socket that
> is listening, and a client program connects to it. The client program
> transfers a name over, and then disconnects from the socket. Now, how
> that is done is usi
Peter Jessop wrote:
> I think the problem here is the 'break' statement.
> Does it not put you outside the while loop whereas in order to keep
> the server socket open you need it to loop forever.
>
> I also think that the s.accept should be inside the while loop.
There are two loops, I think you
import socket
host = ''
port = 57000
s=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)
s.bind((host,port))
s.listen(5)
while 1:
client,addr=s.accept()
client.send("Connected to the server\n")
#if someCondition:
# cliente.clo
I think the problem here is the 'break' statement.
Does it not put you outside the while loop whereas in order to keep
the server socket open you need it to loop forever.
I also think that the s.accept should be inside the while loop.
___
Tutor maillist