Sockets: code works locally but fails over LAN

Bryan Olson fakeaddress at
Sat Sep 3 00:16:21 CEST 2005

n00m wrote:
 > My today's tests (over LAN).
 > I think *it* will drive me mad very soon.

<Conflicting results snipped>

Network programming is like that. Just because something worked
once doesn't mean it really works. I had guessed two causes for
the behavior you were seeing, and either could result in sporadic

 > Bryan wrote:
 >>The client is trying to make more than one connection.
 > I don't think so. Look at the very first line of the vbs:
 > Set cn = CreateObject("ADODB.Connection")
 > Create .Connection! NOT .Connections.

An ADODB connection is not the same as a TCP connection; unless
you have a documented promise, don't expect them to map one-to-
one. I don't know much about ADODB, but it's perfectly normal in
network programming to run multiple logical connections over one
TCP connection, or use multiple TCP connections to carry one
logical connection, or both at the same time.

 >>Glad it worked, but I'd still disrecommend IDLE...
 > But it does NOT work without IDLE!

Odd. What happens if you run it from a command line?

 > [...] But while I don't understand what's going on
 > with the core part of the code this improvement doesn't much
 > matter.

Do you want to be a network engineer? What's going on is too
many unsafe assumptions, and isolating the one (or ones) biting
you could take a lot of your time. My last version, with the
shutdown fix, is a pretty general TCP spy-proxy. The printing is
a bit dodgy, but other than that, I don't think it assumes
anything that TCP doesn't guarantee. (But don't let it walk
alone in crime-ridden neighborhoods such as the Internet.)


More information about the Python-list mailing list