getting socket.bind() exception, but no actual error
clarence at silcom.com
Tue Nov 2 19:07:23 CET 2004
Steve Holden <steve at holdenweb.com> wrote in message news:<RSxhd.2736$931.635 at lakeread01>...
> Clarence Gardner wrote:
> > I've got a problem that I don't see how to program around. A socket server
> > that was running fine, today started getting an exception from the bind()
> > call (errno 22, Invalid argument) and yet the bind had actually worked.
> Is it possible you already have a process bound to that port, and that
> process is handling the incoming connections?
> Otherwise it sounds a little bizarre. In fact even my own attempt at
> explaining doesn't ring true because on Win2k, at least, a second bind
> will raise (10048, 'Address already in use'), and I get a similar error
> on Linux. Rats.
And the whole point of the test in the exception handling suite (checking
for "in use") is to repeat the bind until that's not the case. This is, of
course, in a program in development which sometimes is not able to be
restarted right away after a problem.
> I take it this code has been copied and pasted? For example, if the host
Yep, that's the actual code. Of course, in this actual case, the error it's
getting has no bad effect, because there's no actual problem (and subsequent
operations on that socket proceed normally).
But it remains an odd problem. Clearly from a programming point of view,
one has to assume that an exception actually indicates a problem!
More information about the Python-list