[Python module] select
16.1. select — Waiting for I/O completion¶
This module provides access to the select and poll functions available in most operating systems, epoll available on Linux 2.5+ and kqueue available on most BSD. Note that on Windows, it only works for sockets; on other operating systems, it also works for other file types (in particular, on Unix, it works on pipes). It cannot be used on regular files to determine whether a file has grown since it was last read.
The module defines the following:
Õâ¸öÄ£¿éÌṩ´ó¶àÊý²Ù×÷ϵͳµÄselectºÍpoll¹¦ÄÜ¡£ epollÔÚLinux2.5+¿ÉÓã¬kqueueÔòÓÃÓÚBSD¡£ÔÚwinodwsϵͳÉÏ£¬Ëü½öÓÃÓÚsocket£¬ÔÚÆäËûϵͳÏ£¬ËüÒ²¿ÉÒÔÓÃÓÚÆäËûÀàÐÍ£¨ÌرðÔÚ Unix Ï£¬Ëü»¹¿ÉÒÔÓÃÓÚ ¹ÜµÀ£©¡£Ëü²»ÄÜÓÃÀ´È·¶¨×Ô´ÓÉϴζÁÈ¡ÒÔºóÊÇ·ñÆÕͨÎļþÓÐËùÔö³¤¡£
exception select. error ¶ The exception raised when an error occurs. The accompanying value is a pair containing the numeric error code from errno and the corresponding string, as would be printed by the C function perror .
ÔÚ·¢Éú´íÎó½«Òý·¢Òì³£¡£accompanying Öµ°üº¬´íÎó´úÂëºÍ´íÎóÃèÊöÎı¾£¬ÓÃÓÚʹÓà C ³ÌÐò perror() ´òÓ¡¡£
select. epoll ( [ sizehint=-1 ] ) ¶ (Only supported on Linux 2.5.44 and newer.) Returns an edge polling object, which can be used as Edge or Level Triggered interface for I/O events; see section Edge and Level Trigger Polling (epoll) Objects below for the methods supported by epolling objects.
½ö½öÔÚLinux2.5.44ÒÔÉÏÖ§³Ö¡£
select. poll ( ) ¶ (Not supported by all operating systems.) Returns a polling object, which supports registering and unregistering file descriptors, and then polling them for I/O events; see section Polling Objects below for the methods supported by polling objects.
ËùÓÐϵͳ²»Ö§³Ö¡£
select. kqueue ( ) ¶ (Only supported on BSD.) Returns a kernel queue object object; see section Kqueue Objects below for the methods supported by kqueue objects.
½ö½öÖ§³ÖBSD¡£
select. kevent ( ident , filter=KQ_FILTER_READ , flags=KQ_ADD , fflags=0 , data=0 , udata=0 ) ¶ (Only suppor
Ïà¹ØÎĵµ£º
ÀµÓºƣ¨http://laiyonghao.com£©
½ñÌ죨2009Äê5ÔÂ31ÈÕ£© OurPNP.org ¸ãÁ˸ö¾Û»á»î¶¯£¬ÅªÁËÊ®¼¸¶þÊ®¸öÈËÔÚ¹ãÖݺ£Öé¹ã³¡µÄÌûá´ôÁËÎå¸öСʱ£¬´´ÏÂÁËÎÒÔÚ K ·¿´ôµÄ×ʱ¼ä¼Í¼¡£Ó¦ËûÃǵÄÑûÇ룬ÎÒ×öÁ˸öÌâΪ¡¶Óà python ¿ìËٴÍøÓηþÎñÆ÷¡·µÄСÑݽ²£¬ÒòΪÄDZߵĵçÊÓ¾¹È»²»ÄܽӵçÄÔ£¬ËùÒÔ½²µÄʱºòûÓÐÄܹ»²ÎÕÕ PPT À´½²£¬¹Û ......
Ethereal ×Ô´øÐí¶àÐÒéµÄ decoder,¼òµ¥,Ò×ÓÃ,»ùÓÚwinpcapµÄÒ»¸ö¿ªÔ´µÄÈí¼þ.µ«ÊÇËüµÄ¼Ü¹¹²¢²»Áé»î,ÈçºÎÄãÒª¼ÓÈëÒ»¸ö×Ô¼º¶¨ÒåµÄµÄ½âÂëÆ÷,µÃÈ¥ÐÞ¸Ä EtherealµÄ´úÂë,ÔÙÖØбàÒë,ºÜ·³Ëö.¶ÔÓÚÒ»°ãµÄÃ÷ÎÄ ÐÒé,ûÓÐʲôÎÊÌâ,µ«ÊǶÔÓÚ¼ÓÃÜÐÒé,±ÈÈçÍøÂçÓÎÏ·,¿Í»§¶Ë³ÌÐòÒ»°ã»áÔÚ¸ÕÁ¬½ÓÉϵÄʱºò,·¢ËÍÒ»¸öËæ»úÃÜÔ¿,¶øºóµÄ±¨ÎĶ¼»áÓÃÕ⸠......
½ñÌì¿´¿´ÈçºÎÓÃpythonʵÏÖ×¥°ü¡£
ÒÔÇ°ÎÒÃÇÔøÓùýwinpcapʵÏÖ×¥°ü£¬Æäʵ½ñÌìÎÒÃÇ»¹ÊÇÓÃËü£¬Ö»²»¹ýÊÇËüÔÚpythonϵÄÄ£¿é£¬ÔÚÓÃ֮ǰÎÒÃDZØÐëÏÈÏÂÔØÁ½¸ö¿â£¬pcap¿âºÍdpkt¿â£¬Õâ¸ö¿ÉÒÔÔÚGoogle codeÀïºÜÈÝÒ×ÕÒµ½£¬ÐèҪעÒâµÄÊÇpcapÖ»Ö§³Öµ½python2.5 £¬ËùÒÔÎÒÃÇÒªÓÃ2.5À´±àд¡£
°²×°ÍêÁ ......
×ÛÊö
¶àÏß³ÌÊdzÌÐòÉè¼ÆÖеÄÒ»¸öÖØÒª·½Ã棬ÓÈÆäÊÇÔÚ·þÎñÆ÷Deamon³ÌÐò·½Ãæ¡£ÎÞÂÛºÎÖÖϵͳ£¬Ï̵߳÷¶ÈµÄ¿ªÏú¶¼±È´«Í³µÄ½ø³ÌÒª¿ìµÃ¶à¡£
Python¿ÉÒÔ·½±ãµØÖ§³Ö¶àÏ̡߳£¿ÉÒÔ¿ìËÙ´´½¨Ï̡߳¢»¥³âËø¡¢ÐźÅÁ¿µÈµÈÔªËØ£¬Ö§³ÖÏ̶߳Áдͬ²½»¥³â¡£ÃÀÖв»×ãµÄÊÇ£¬PythonµÄÔËÐÐÔÚPython
ÐéÄâ»úÉÏ£¬´´½¨µÄ¶àÏß³Ì¿É ......
PythonµÄ´´Ê¼ÈËΪGuido van
Rossum¡£1989ÄêÊ¥µ®½ÚÆڼ䣬ÔÚ°¢Ä·Ë¹Ìص¤£¬GuidoΪÁË´ò·¢Ê¥µ®½ÚµÄÎÞȤ£¬¾öÐÄ¿ª·¢Ò»¸öеĽű¾½âÊͳÌÐò£¬×öΪ ABC
ÓïÑÔµÄÒ»Öּ̳С£Ö®ËùÒÔÑ¡ÖÐ Python£¨´óòþÉßµÄÒâ˼£©×÷Ϊ³ÌÐòµÄÃû×Ö£¬ÊÇÒòΪËûÊÇÒ»¸öMonty PythonµÄ·ÉÐÐÂíÏ·Íŵİ®ºÃÕß¡£
ABCÊÇÓÉGuido²Î¼ÓÉè¼ÆµÄÒ»ÖÖ½ÌѧÓïÑÔ¡£¾ÍGuido±¾ÈË¿´ ......