Timeout for UDP receive

Lego Andy andy at x0.org
Tue Oct 17 10:01:18 EDT 2000


Hi!

Is there any way to achieve the timeout after certain period of time
if there is no UDP packages received?

For example:

while 1:
	do_timeout()

	data, addr = server.recvfrom(BUFSIZE)
	print 'Got: %s' % PrintBuff(data, len(data)),
	print ' from:', `addr`

	if timeout:
		tm=1
		break

if tm:
	there was timeout



				Andy



More information about the Python-list mailing list