Gabriel Genellina wrote:
En Wed, 09 Jul 2008 15:02:56 -0300, Mirko Vogt <li***@nanl.dee scribi�:
>it seems that the socket-module behaves differently on unix / windows when a timeout is set.
[...]
>Now I will change the code slightly - to be precise I set a timeout on the socket:
# test.py
import socket sock=socket.so cket(socket.AF_ INET,socket.SOC K_STREAM) sock.settimeou t(3.0) # <----- print 'trying to connect...' sock.connect(( '127.0.0.1',999 9)) print 'connected!'
# executed on linux
$ python test.py trying to connect... Traceback (most recent call last): File "test.py", line 5, in <module> sock.connect((' 127.0.0.1',9999 )) File "<string>", line 1, in connect socket.error : (111, 'Connection refused') $
# executed on windows
>>C:\Python25\p ython.exe test.py
trying to connect... connected!
Which Python version? Which Windows version? I've tried 2.3.4, 2.4.4,
2.5.1 and 3.0a4, all on WinXP SP2, and in all cases I got an exception
(details differ between versions). In no case I could make the
connection succeed when nobody was listening at port 9999, as expected.
Hey, this is strange.
Linux:
$ python --version
Python 2.5.2
$
Windows:
C:\Python25>pyt hon.exe --version
Python 2.5.2
C:\Python25>
Mirko 0 981 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Achim Domma |
last post by:
Hi,
I'm using Python 2.3s timeout sockets and have code like this to read a page
from web:
request = ...
self.page = urllib2.urlopen(request)
and later:
|
by: Tim Williams |
last post by:
(python newbie)
Is it possible to individually set the socket timeout of a connection
created by smtplib, rather than use the socket.setdefaulttimeout() value
used by the rest of the prog/script?
eg:
import smtplib
import (other stuff)
|
by: John Hunter |
last post by:
I have a test script below which I use to fetch urls into strings,
either over https or http. When over https, I use m2crypto.urllib and
when over http I use the standard urllib. Whenever, I import sockets
and setdefaulttimeout, however, using m2crypto.urllib tends to cause a
http.BadStatusLine to be raised, even if the timeout is set to be very
large. All of the documents in the test script can be accessed
publicly.
Any ideas? Is...
|
by: Tarek Ziadé |
last post by:
Hello,
anyone knows a way to deal with this problem ?
http://sourceforge.net/tracker/index.php?func=detail&aid=1153016&group_id=5470&atid=105470
This bug has been fixed in 2.3 but there is a regression in 2.4
Tarek
|
by: Paola |
last post by:
Hi,
I have a very strange problem with PowerTCP:
I made a wrapper between a server web and the browsers.
If the client ask Html pages or images there is no problem instead if
the client ask a pdf file or a zip file the response is "Object are
closed in the middle of the SSL handshake" and I receive half file.
Instead if I use another kind of procedure I receive a file too big
(e.g. original format 22 kb byte received 23 kb) the result of...
| |
by: Franky |
last post by:
Hello,
How can I set timeout on the send for an asynchronous socket? I use the
setsocketoption's timeout but it does not seem work. The program is blocked
at the socket's EndSend step until the remote side closes the connection.
Thanks in advance,
Franky
|
by: Jaap Spies |
last post by:
Hi,
Running Fedora Core 4: Python 2.4.3 and Python 2.4.1.
I'm getting:
IOError: (2, 'No such file or directory')
all the time.
Trying to track down this problem:
Python 2.4.1 (#1, May 16 2005, 15:19:29)
|
by: yawnmoth |
last post by:
Say I have the following script:
<?
$timeout = 5;
$start = time();
$fsock = fsockopen('125.1.119.10',80,$errno,$errstr,$timeout);
// reduce $timeout by the amount of time that it took for fsockopen to
connect.
$timeout-=(time()-$start);
|
by: samido |
last post by:
Guys, anyone ever experience this on the server and know how to solve it? it happenes when I try to copy and paste(deploy) some .ear and .jar files on the server(JBoss)
"java.net.SocketTimeoutException: Read timed out"
please help ...
Sam Rabophala
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |