Re: how to fill many data strings from socket.recvfrom()

2007-11-03 Thread Mark T
"lgwe" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I want to receive 200 udp datagrams. Each into a new data string. > But I dont know how to do that, this is wrong: > > import socket > s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM) > s.bind(("",port)) > i = 0 > while i<200:

Re: how to fill many data strings from socket.recvfrom()

2007-11-03 Thread GuillaumeC
> data[i] is illegal. > Any suggestion welcome! Either initialize data before: data=[0]*200 before "while" or (better): ... i=0 data=[] for i in range(200): d,addr= s.recvfrom(1024) data.append(d) -- http://mail.python.org/mailman/listinfo/python-list

how to fill many data strings from socket.recvfrom()

2007-11-03 Thread lgwe
I want to receive 200 udp datagrams. Each into a new data string. But I dont know how to do that, this is wrong: import socket s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM) s.bind(("",port)) i = 0 while i<200: data[i],addr = s.recvfrom(1024) i = +1 data[i] is illegal. Any suggestio