Jiaxin
December 19, 2006, 10:14pm
1
Hi,
I use closesocket to close a socket, it return 0, looks like success, but the socket number remains. When I try to open a new socket, it fails, return 0xfffffff.
I’m wondering is this because the old one close is not success or other reason?
Thanks
Jiaxin
Cameron
December 20, 2006, 4:31am
2
Are you calling close() or closesocket()? In NET+OS the proper routine to call is closesocket().
egawtry
December 21, 2006, 8:32pm
3
“but the socket number remains”?
================================
SOCKET fds = socket();
…
closesocket(fds);
Naturally fds will still have a number in it. You need to set it to INVALID_SOCKET (-1) after you call closesocket().
================================
fds = -1;
Could you please post your code so we could take a look to see where opening the new socket fails?
-Erik
Jiaxin
December 20, 2006, 6:48pm
4
I use closesocket().
Another similar thing is serial port.
I use close() for it.
Twan
February 8, 2007, 2:07pm
5
Do you have a socket connection with the device and you can control the GPIO?