SOCK_CLOSE followed by SOCK_TCPCONNECT failing

Previous topic - Next topic

FutureCow

I'll write a test program for this tomorrow but here's what I've seen in my program. If I can reproduce it in a very small test program I'll list it as a bug.

If I have a network error (due to a bug in my code  ;) ) both my client and server do a sock_close on the connection.
If, without restarting my program, I try and start the game again, the SOCK_TCPCONNECT returns -2 (a non-blocking socket operation could not be completed immediately).

So I tried putting a sock_close at the top of my client and server functions, just before they do the SOCK_TCPCONNECT and SOCK_TCPACCEPT. This didn't help.

I tried debugging it and put a breakpoint on my SOCK_TCPCONNECT line. After breaking the first connection, I started the server then the client. With the breakpoint it now established the connection. I try that a second time and now (and every time after) it returns -2 again.

Thoughts?

MrTAToad

Its similar to a problem that I had a long while ago when trying to open a socket after using NETWEBGET...

Gernot fixed that with a non-blocking socket, I think - so I wonder if thats the cause :)

Kitty Hello

all sockets in GLBasic are non blocking.