[python] timeout, cancel

Radovan Garabik spam na melkor.dnp.fmph.uniba.sk
Pátek Srpen 22 11:05:08 CEST 2003


Petr Van?k <petr.vanek na ika.cz> wrote:
 : On St, 2002-10-16 at 19:48, Petr Vanek wrote:
 :> > Chtelo by to predevsim zminit zpusob "komunikace" se serverem...
 :> to bylo mozna moc honosne slovo "komunikace"
 :> jak ale osetrim, ze toto se povede v takove dobe, aby uzivatel nemusel
 :> cekat pul dne?
 :> 
 :> sysid = urllib.urlopen(url)

 : http://www.timo-tasi.org/python/timeoutsocket.py
 : treba to pomuze.

v pythone 2.3 je tiez toto (metody socket):

   settimeout(value)
          Set a timeout on blocking socket operations. The value argument can be a
          nonnegative float expressing seconds, or None. If a float is given, subsequent
          socket operations will raise an error exception if the timeout period value has
          elapsed before the operation has completed. Setting a timeout of None disables
          timeouts on socket operations. s.settimeout(0.0) is equivalent to
          s.blocking(0); s.settimeout(None) is equivalent to s.setblocking(1). New in
          version 2.3.




-- 
 -----------------------------------------------------------
| Radovan Garabík  http://melkor.dnp.fmph.uniba.sk/~garabik |
| __..--^^^--..__         garabik @ fmph . uniba . sk       |
 -----------------------------------------------------------
Antivirus alert: file .signature infected by signature virus.
Hi! I'm a signature virus! Copy me into your signature file to help me spread!



Další informace o konferenci Python