From: Greg2fs on
Hello, I have a common problem, after my program crash without
cleaningup winsock correctly I can't bind anymore on the same port,
the only way I found is to restat my windows session.
I tried using SO_REUSEADDR but it just make the bind error hidding not
allowing the communication anymore.

Then as it don't seems to be a material problem (I tried
uninstalling / reinstalling my network card and still can't bind) I
would like to know how to reset the windows component handling the
bind fonction, in other words I would like to reset winsock.

Thanks
From: Richard Heathfield on
Greg2fs wrote:
> Hello, I have a common problem, after my program crash without
> cleaningup winsock correctly I can't bind anymore on the same port,
> the only way I found is to restat my windows session.
> I tried using SO_REUSEADDR but it just make the bind error hidding not
> allowing the communication anymore.
>
> Then as it don't seems to be a material problem (I tried
> uninstalling / reinstalling my network card and still can't bind) I
> would like to know how to reset the windows component handling the
> bind fonction, in other words I would like to reset winsock.

That's the wrong solution. The right solution is to find out why your
program is crashing, and fix it so that it doesn't crash any more.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
"Usenet is a strange place" - dmr 29 July 1999
Sig line vacant - apply within
From: David Schwartz on
On Apr 11, 11:48 pm, Greg2fs <greg...(a)gmail.com> wrote:

> Hello, I have a common problem, after my program crash without
> cleaningup winsock correctly I can't bind anymore on the same port,

What happens when you try?

> the only way I found is to restat my windows session.
> I tried using SO_REUSEADDR but it just make the bind error hidding not
> allowing the communication anymore.

What bind error?

> Then as it don't seems to be a material problem (I tried
> uninstalling / reinstalling my network card and still can't bind) I
> would like to know how to reset the windows component handling the
> bind fonction, in other words I would like to reset winsock.

You forgot to describe your problem. Does some Winsock function return
an error? If so, what function and what error? Or do the functions
succeed and then something doesn't happen? If so, what?

DS
From: Leo Davidson on
On Apr 12, 7:50 am, Richard Heathfield <r...(a)see.sig.invalid> wrote:

> That's the wrong solution. The right solution is to find out why your
> program is crashing, and fix it so that it doesn't crash any more.

Of course he should be investigating the crashes but he'll be able to
do that a lot quicker if he doesn't have to restart his machine after
each crash. :)
From: Ulrich Eckhardt on
Greg2fs wrote:
> Hello, I have a common problem, after my program crash without
> cleaningup winsock correctly I can't bind anymore on the same port,
> the only way I found is to restat my windows session.
> I tried using SO_REUSEADDR but it just make the bind error hidding not
> allowing the communication anymore.

The reason for that is probably that the socket is still considered in use,
which is also why you can patch it partially by using SO_REUSEADDR. There
are two reasons that could be the case:
1. The program is actually still running. A crash can mean pretty much
anything, it doesn't have to be the executable being terminated, which
would normally clean up the resources.
2. The timeout for the socket hasn't elapsed yet. I think that without
properly shutting down, it can take a minute until the port can be bound
again.

Uli

--
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932