Re: invalid socket in accept()
AF_INET is perfectly ok, no need to change that. The socket itself seems to be valid, and passing "this" to the thread gives the thread access to the dialog. There must be something else that crashes, and that's why I asked for a call stack when the crash happens. I agree to ahoodin that a memory overwrite is more than likely.
Re: invalid socket in accept()
Uh yep thats what I have been trying to say all along.
:D:D:D
Quote:
Originally Posted by
ahoodin
I am looking at this line:
Code:
for (int i=0; i<40; i++ )
sClient[i] = NULL;
Please show the code where you declare and define sClient.
Perhaps your overwriting your sockets with this line, that may be
overrunning your buffer and overwriting part of your socket variable
memory.
Note:
If you declare your memory such as this:
Code:
unsigned char sClient[32];
short Port;
int socket;
and then later use the previous loop, you will overrun the buffer and screw up the socket variable.
Have a look at the socket value in the debugger before and after this loop runs. This is
just an example, and may not be exactly what is going on with your code. In debug mode,
the compiler will allow overruns, and in release mode it will most likely have memory exceptions.
This may explain the changes in the code's behavior over time.
We can't really help without a complete source listing.