套接字读取超时 [英] socket read timeout

查看:125
本文介绍了套接字读取超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我正在寻找实现套接字的最有效/最干净的方式

读取超时(Windows主要是但如果相同的代码

在* nix下工作)


坦克,


hg

解决方案

hg napisa3(a):


我正在寻找最有效/最干净的方式实现套接字

读取超时(Windows主要但如果相同代码

在* nix下工作则会很棒)



您是否看过 http://www.timo- tasi.org/python/timeoutsocket.py


-

Jarek Zgoda


我们读了Knuth,所以你没必要。


Jarek Zgoda写道:


hg napisa3(a):

>我正在寻找实现套接字的最有效/最干净的方式
读取超时(Windows主要但如果相同的代码工作将会很好)在* nix)



你看到 http://www.timo-tasi.org/python/timeoutsocket.py



请注意,自2.4以来,我相信,标准库中的套接字允许

你指定一个超时参数。


问候

Steve

-

Steve Holden +44 150 684 7255 +1 800 494 3119

Holden Web LLC / Ltd http://www.holdenweb.com

Skype:holdenweb http://del.icio.us/steve.holden

最近的Ramblings http://holdenweb.blogspot.com



>我正在寻找最有效/最干净的方法来实现带超时的
套接字读取(Windows主要但会很棒)如果
相同的代码在* nix下工作)



JarekDid你看到 http://www.timo-tasi.org/python/timeoutsocket.py


套接字对象现在也有超时属性。


跳过


Hi,

I am looking for the most efficient / cleanest way to implement a socket
read with timeout (Windows mainly but would be great if the same code
worked under *nix)

Tanks,

hg

解决方案

hg napisa3(a):

I am looking for the most efficient / cleanest way to implement a socket
read with timeout (Windows mainly but would be great if the same code
worked under *nix)

Did you see http://www.timo-tasi.org/python/timeoutsocket.py ?

--
Jarek Zgoda

"We read Knuth so you don''t have to."


Jarek Zgoda wrote:

hg napisa3(a):

>I am looking for the most efficient / cleanest way to implement a socket
read with timeout (Windows mainly but would be great if the same code
worked under *nix)


Did you see http://www.timo-tasi.org/python/timeoutsocket.py ?

Note that since 2.4, I believe, sockets in the standard library allow
you to specify a timeout parameter.

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
Recent Ramblings http://holdenweb.blogspot.com


>I am looking for the most efficient / cleanest way to implement a
socket read with timeout (Windows mainly but would be great if the
same code worked under *nix)

JarekDid you see http://www.timo-tasi.org/python/timeoutsocket.py ?

Also socket objects have timeout attributes now.

Skip


这篇关于套接字读取超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆