473,326 Members | 2,012 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

socket settimeout ?

I have set up a socket listener that needs to listen indefinitely. On an
incoming call I get a connection object that I want to set a timeout on
[Win2k, Py2.3.2]. As the setdefaulttimeout method did not work with the new
connection I found (using dir on the socket._socket object) a settimeout
method. Is this (undocumented) method peculiar to Windows or fully
cross-platform?

code fragment:
conn = rcv.nextConnAddr()
print conn
print
print dir(conn[0])
conn[0].settimeout(30.0)
rcv.rxThread(conn)
output:
(<socket._socketobject object at 0x0095B7E0>, ('10.10.192.240', 3524))

['__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__',
'__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__',
'__repr__', '__setattr__', '__slots__', '__str__', '_sock', 'accept',
'bind', 'close', 'connect', 'connect_ex', 'dup', 'fileno', 'getpeername',
'getsockname', 'getsockopt', 'gettimeout', 'listen', 'makefile', 'recv',
'recvfrom', 'send', 'sendall', 'sendto', 'setblocking', 'setsockopt',
'settimeout', 'shutdown']

Thanks
Colin Brown
PyNZ


Jul 18 '05 #1
0 1718

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Nagy László Zsolt | last post by:
Hi Python Gurus! Here is a method I used before to receive data over a socket (with Python 2.2): SELECT_GRANULARITY = 0.1 # 0.1 seconds def readdata(self,length,timeout): res = '' remain...
0
by: Nagy László Zsolt | last post by:
Hi Python Gurus! Here is a method I used before to receive data over a socket (with Python 2.2): SELECT_GRANULARITY = 0.1 # 0.1 seconds def readdata(self,length,timeout): res = '' remain...
0
by: Colin Brown | last post by:
Python2.3.2: Running the following receiver and sender code in separate windows under Win2K does not work properly (missed & very delayed transmissions). Under Redhat Linux 9 (where I will be using...
3
by: Thomas Hervé | last post by:
My problem is not really python specific but as I do my implementation in python I hope someone here can help me. I have two programs that talk through a socket. Here is the code : <server>...
4
by: flupke | last post by:
Hi, I have a gui (made in wxPython) that enables a user to connect to a server and issue some commands. The problem occurs when i try to disconnect the client. It exits but it doesn't return to...
0
by: PantherSE | last post by:
Hello, Ok, here's my situation. I have a small application that listens to messages on a UDP port. When I pass None to settimeout(), and I hit Ctrl+C to interrupt the wait my exception...
5
by: Russell Warren | last post by:
Does anyone know the scope of the socket.setdefaulttimeout call? Is it a cross-process/system setting or does it stay local in the application in which it is called? I've been testing this and...
1
by: jnair | last post by:
When using socket.socket.settimeout we normally only guard against "socket.timeout" exception.Now the implementation of "settimeout" in "Python-2.4.3/Modules/socketmodule.c" sets the socket fd to...
10
by: Hendrik van Rooyen | last post by:
While doing a netstring implementation I noticed that if you build a record up using socket's recv(1), then when you close the remote end down, the recv(1) hangs, despite having a short time out...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.