"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:
> 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
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