Hmm.. Whatever would be the Python equivalent to this? *ponders*

Jp Calderone exarkun at flashmail.com
Fri Mar 24 17:33:42 EST 2000


Falknor wrote:
> 
> Allo peoples,
> 
> Whatever would be the Python equivalent to the code below? 
> Converting an old C program to Python..  I know how to do 
> it all other than what to do about the fd_set's and the 
> various FD_* macro's....  Any help would be appreciated :)
> 
> JD
> [snip C code]

Roughly analagous:

	import select

	in_set = getInputSocketsArray()   # May be the
	out_set = getOutputSocketArray()  # same arrays
	exc_set = getExceptionSocketArray() #ie, all your
					  # characters in game
	control = getControlSocket()     # the socket you listen on
					 # should also be in in_set

	# 0.1 is number of seconds to block
	ins, outs, excs = select.select(in_set, out_set, exc_set, 0.1)

	if control in ins:
		# handle new connection
		pass

	for char in excs:
		# disconnect character
		pass

	for char in ins:
		# handle character input
		pass


 Jp

-- 
No, `Eureka' is Greek for `This bath is too hot.'
                -- Dr. Who
--
 10:23pm up 18 days, 4:52, 1 user, load average: 0.02, 0.04, 0.00



More information about the Python-list mailing list