I'm having an issue where my program hangs while doing
socket.connect( ) for a couple minutes, then times out the connection
and crashes. I'm connecting to an apache2 process on the same machine,
for testing. When looking at netstat, the socket is in the SYN_SENT
state, like this:
$netstat -a -tcp
tcp 0 0 *:www *:*
LISTEN 7635/apache2
tcp 0 1 bukzor:38234 adsl-75-61-84-249.d:www
SYN_SENT 9139/python
Anyone know a general reason this might happen? Even better, a way to
fix it?
Doing a minimal amount of research, I found this in the netstat
manual:
The state SYN_SENT means that an application has made arequest for a
TCP session, but has not yet received the return SYN+ACK packet.
This would indicate it's a server issue, but it seems very stable when
I look at it via a browser.
Here's the server. If you browse to it, it documents the exported
functions: http://bukzor.hopto.org/modpython/xmlrpc.py
Here's my test client that's hanging. Turn 'verbose' to True to get
more debugging info. -
#!/usr/bin/env python
-
from xmlrpclib import ServerProxy
-
-
s = ServerProxy("http://bukzor.hopto.org/modpython/xmlrpc.py",
-
verbose=False)
-
-
print s.helloworld()
-
print s.add(1,2)
-
print s.subtract(1,2)
-
Thanks,
--Buck 9 18555
On Sat, Jul 12, 2008 at 11:23 PM, bukzor <wo**********@g mail.comwrote:
I'm connecting to an apache2 process on the same machine,
for testing. When looking at netstat, the socket is in the SYN_SENT
state, like this:
$netstat -a -tcp
tcp 0 0 *:www *:* LISTEN 7635/apache2
tcp 0 1 bukzor:38234 adsl-75-61-84-249.d:www SYN_SENT 9139/python
Anyone know a general reason this might happen? Even better, a way to
fix it?
That socket connection is to a remote machine, not the same one. Your
test code works fine for me. The "hang then crash" (and I'm assuming
"crash" here means an uncaught exception) just means that your packets
are being silently ignored by whatever machine you're actually
attempting to connect to. It's possible that your machine has odd DNS
settings causing buzkor.hopto.or g to resolve to the wrong address.
-Miles
On Jul 13, 1:14*am, Miles <semantic...@gm ail.comwrote:
On Sat, Jul 12, 2008 at 11:23 PM, bukzor <workithar...@g mail.comwrote:
I'm connecting to an apache2 process on the same machine,
for testing. When looking at netstat, the socket is in the SYN_SENT
state, like this:
$netstat -a -tcp
tcp * * * *0 * * *0 *:www * * * * * * * ** *:* LISTEN * * *7635/apache2
tcp * * * *0 * * *1 bukzor:38234 * * * * * *adsl-75-61-84-249.d:www SYN_SENT * *9139/python
Anyone know a general reason this might happen? Even better, a way to
fix it?
That socket connection is to a remote machine, not the same one. *Your
test code works fine for me. *The "hang then crash" (and I'm assuming
"crash" here means an uncaught exception) just means that your packets
are being silently ignored by whatever machine you're actually
attempting to connect to. It's possible that your machine has odd DNS
settings causing buzkor.hopto.or g to resolve to the wrong address.
-Miles
I'm connecting to my machine through the internet, and the resolved
URL of my router is what you're seeing above. If you run the code
above you'll see what I mean.
Thanks tho,
--Buck
On Sun, Jul 13, 2008 at 2:32 PM, bukzor <wo**********@g mail.comwrote:
On Jul 13, 1:14 am, Miles <semantic...@gm ail.comwrote:
>On Sat, Jul 12, 2008 at 11:23 PM, bukzor <workithar...@g mail.comwrote:
I'm connecting to an apache2 process on the same machine,
for testing. When looking at netstat, the socket is in the SYN_SENT
state, like this:
$netstat -a -tcp
tcp 0 0 *:www *:* LISTEN 7635/apache2
tcp 0 1 bukzor:38234 adsl-75-61-84-249.d:www SYN_SENT 9139/python
Anyone know a general reason this might happen? Even better, a way to
fix it?
That socket connection is to a remote machine, not the same one. Your test code works fine for me. The "hang then crash" (and I'm assuming "crash" here means an uncaught exception) just means that your packets are being silently ignored by whatever machine you're actually attempting to connect to. It's possible that your machine has odd DNS settings causing buzkor.hopto.or g to resolve to the wrong address.
I'm connecting to my machine through the internet, and the resolved
URL of my router is what you're seeing above. If you run the code
above you'll see what I mean.
I did run the code, and as I said, it works fine. Your description of
the setup is not consistent. The netstat output unambiguously states
that a Python script on "buzkor" is attempting to open a connection to
the HTTP port on the "adsl" machine (and failing because "adsl" is not
responding). The problem here is not Python; you seem to be confused
about which machine is connecting to which.
-Miles
On Jul 13, 1:08 pm, Miles <semantic...@gm ail.comwrote:
On Sun, Jul 13, 2008 at 2:32 PM, bukzor <workithar...@g mail.comwrote:
On Jul 13, 1:14 am, Miles <semantic...@gm ail.comwrote:
On Sat, Jul 12, 2008 at 11:23 PM, bukzor <workithar...@g mail.comwrote:
I'm connecting to an apache2 process on the same machine,
for testing. When looking at netstat, the socket is in the SYN_SENT
state, like this:
$netstat -a -tcp
tcp 0 0 *:www *:* LISTEN 7635/apache2
tcp 0 1 bukzor:38234 adsl-75-61-84-249.d:www SYN_SENT 9139/python
Anyone know a general reason this might happen? Even better, a way to
fix it?
That socket connection is to a remote machine, not the same one. Your
test code works fine for me. The "hang then crash" (and I'm assuming
"crash" here means an uncaught exception) just means that your packets
are being silently ignored by whatever machine you're actually
attempting to connect to. It's possible that your machine has odd DNS
settings causing buzkor.hopto.or g to resolve to the wrong address.
I'm connecting to my machine through the internet, and the resolved
URL of my router is what you're seeing above. If you run the code
above you'll see what I mean.
I did run the code, and as I said, it works fine. Your description of
the setup is not consistent. The netstat output unambiguously states
that a Python script on "buzkor" is attempting to open a connection to
the HTTP port on the "adsl" machine (and failing because "adsl" is not
responding). The problem here is not Python; you seem to be confused
about which machine is connecting to which.
-Miles
The problem only manifests about 1 in 20 runs. Below there's code for
a client that shows the problem 100% of the time.
The two URL's that I seem to be "confused" about point to the same IP.
Maybe this will make it clear:
PING bukzor.hopto.or g (75.61.84.249) 56(84) bytes of data.
64 bytes from adsl-75-61-84-249.dsl.pltn13. sbcglobal.net
(75.61.84.249): icmp_seq=1 ttl=255 time=1.68 ms
64 bytes from adsl-75-61-84-249.dsl.pltn13. sbcglobal.net
(75.61.84.249): icmp_seq=2 ttl=255 time=0.493 ms
64 bytes from adsl-75-61-84-249.dsl.pltn13. sbcglobal.net
(75.61.84.249): icmp_seq=3 ttl=255 time=0.602 ms
Apparently netstat truncated the URL before. Here's the code I
mentioned: -
#!/usr/bin/env python
-
from xmlrpclib import ServerProxy
-
from time import time
-
-
s = ServerProxy("http://bukzor.hopto.org/modpython/xmlrpc.py",
-
verbose=True)
-
-
i = 0
-
start = time()
-
while True:
-
print s.helloworld()
-
print s.add(1,2)
-
print s.subtract(1,2)
-
i += 3
-
print "AVG: %.2fs" % ((time() - start) / i)
-
Thanks,
--Buck
On Sun, Jul 13, 2008 at 8:35 PM, bukzor <wo**********@g mail.comwrote:
The problem only manifests about 1 in 20 runs. Below there's code for
a client that shows the problem 100% of the time.
The two URL's that I seem to be "confused" about point to the same IP.
Maybe this will make it clear:
PING bukzor.hopto.or g (75.61.84.249) 56(84) bytes of data.
64 bytes from adsl-75-61-84-249.dsl.pltn13. sbcglobal.net
(75.61.84.249): icmp_seq=1 ttl=255 time=1.68 ms
For me, buzkor.hopto.or g resolves to 69.65.19.125, which I hope
explains why I thought you were confused, and increases my own
suspicion that DNS settings are to blame. I let the script run for
about five minutes without it failing.
Does your luck change if you use "localhost" or a numeric IP address
in the ServerProxy URL?
-Miles
On Sun, Jul 13, 2008 at 9:31 PM, Miles <se*********@gm ail.comwrote:
On Sun, Jul 13, 2008 at 8:35 PM, bukzor <wo**********@g mail.comwrote:
>The problem only manifests about 1 in 20 runs. Below there's code for a client that shows the problem 100% of the time.
The two URL's that I seem to be "confused" about point to the same IP. Maybe this will make it clear:
PING bukzor.hopto.or g (75.61.84.249) 56(84) bytes of data. 64 bytes from adsl-75-61-84-249.dsl.pltn13. sbcglobal.net (75.61.84.249) : icmp_seq=1 ttl=255 time=1.68 ms
For me, buzkor.hopto.or g resolves to 69.65.19.125
Ahhh... "bukzor". Well, that makes sense. Pardon my temporary dyslexia.
-Miles
On Sat, Jul 12, 2008 at 11:23 PM, bukzor <wo**********@g mail.comwrote:
Anyone know a general reason this might happen? Even better, a way to
fix it?
Another reason that a socket can hang in the SYN_SENT state (besides
trying to connect to an unreachable host without getting an ICMP
destination-unreachable message in response): if the server's listen
queue is full, it will silently ignore SYN packets until there is room
in the queue.
Sorry again about the "bukzor" vs. "buzkor" thing. I don't know
what's causing your problem (and it's probably not a DNS issue after
all) but it's more likely to be a server issue than a client one.
Maybe your client has an unusually low socket timeout for some reason,
though; does increasing it (with socket.setdefau lttimeout) help? Mine
seems to default to about 75 seconds.
If you can't work out the root cause, but it only happens every once
in a while, you could try changing your client code to catch the
socket exception and retry a limited number of times.
-Miles
On Sun, Jul 13, 2008 at 10:29 PM, Miles <se*********@gm ail.comwrote:
On Sat, Jul 12, 2008 at 11:23 PM, bukzor <wo**********@g mail.comwrote:
>Anyone know a general reason this might happen? Even better, a way to fix it?
Maybe your client has an unusually low socket timeout for some reason,
though; does increasing it (with socket.setdefau lttimeout) help?
Never mind on that, as you already said that it hangs for about two
minutes. Clearly my reading comprehension and retention rate are at
an all-time low today.
low-signal-to-noise-ratio-ly yours,
Miles
On Jul 13, 6:31 pm, Miles <semantic...@gm ail.comwrote:
On Sun, Jul 13, 2008 at 8:35 PM, bukzor <workithar...@g mail.comwrote:
The problem only manifests about 1 in 20 runs. Below there's code for
a client that shows the problem 100% of the time.
The two URL's that I seem to be "confused" about point to the same IP.
Maybe this will make it clear:
PING bukzor.hopto.or g (75.61.84.249) 56(84) bytes of data.
64 bytes from adsl-75-61-84-249.dsl.pltn13. sbcglobal.net
(75.61.84.249): icmp_seq=1 ttl=255 time=1.68 ms
For me, buzkor.hopto.or g resolves to 69.65.19.125, which I hope
explains why I thought you were confused, and increases my own
suspicion that DNS settings are to blame. I let the script run for
about five minutes without it failing.
Does your luck change if you use "localhost" or a numeric IP address
in the ServerProxy URL?
-Miles
It seems to work fairly perfectly If i use localhost or even my LAN IP
address, but starts to fail if I go beyond that.
You said you ran it for five minuts without error. Did it error out
after that? If you can't reproduce it, that would indicate something
else. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: anuradha.k.r |
last post by:
hi,
i am writing a socket program in python,both client side and server
side.I've written the client side which is working perfectly
fine(checked it against server program written in C).but as for my
server program written in python it simply hangs.it does not show any
error also.I've tried sample programs available .I don understand what
the reason is as i am quite new to it.
here is teh server side program:
///////////////////////
|
by: Ted Burhan |
last post by:
I was wondering if there is a way to adjust the timeout period when doing
Socket.Connect()
I have been looking at the docs, found nothing
|
by: yaron |
last post by:
Hi,
I want to use non-blocking socket operations (and not async socket operations)
When i use this code :
socket.Blocking = false;
socket.Connect(remote);
i get this error :
|
by: yaron |
last post by:
Hi,
1. It seems to me that there is a bug when using non-blocking socket
connect operation, because the LocalEndPoint, RemoteEndPoint of the Socket
are nulls on the client side although that the client and the server are
already connected.
2. If it is a bug, is there any hotfix for this ?
Thanks.
|
by: Ted Burhan |
last post by:
I was wondering if there is a way to adjust the timeout period when doing
Socket.Connect()
I have been looking at the docs, found nothing
| |
by: DaTurk |
last post by:
I am makeing a Multicast server client setup and was wondering what the
difference is between Socket.Connect, and Socket.Bind.
It may be a stupid question, but I was just curious. Because I tried a
test, and I can't bind two sockets to the same port/ip but I can
connect with one socket, and bind with another to the same ip/port.
Thanks
|
by: doc |
last post by:
What will a flash xml client socket connect to?
I have a working php TCP/IP server socket bound to a port >1023 and the flash client will not even connect to it. I can connect to it with non-xml client.
Can anyone explain this to me - it has been driving me mad for weeks!
Please help!
Thanks
|
by: Qui Sum |
last post by:
I write ip/port scanner so users using search on our LAN know if the particular ftp is online or not.
The class I write has the following structure:
public class IPScanner
{
public IPScanner() { }
private void connect(object data)
|
by: A. W. Dunstan |
last post by:
I'm creating a socket as follows:
m_networkSocket = new Socket(AddressFamily.InterNetwork,
SocketType.Stream,
ProtocolType.Tcp);
m_networkSocket.LingerState = new LingerOption(true, 1);
m_networkSocket.Blocking = true;
m_networkSocket.SetSocketOption(SocketOptionLevel.Socket,
SocketOptionName.NoDelay, true);
m_networkSocket.SetSocketOption(SocketOptionLevel.Socket,
|
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: 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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |