The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: realcr on March 16, 2006, 08:58:40 AM

Title: different behaviour on restart
Post by: realcr on March 16, 2006, 08:58:40 AM
Hi everyone.

I was following IcZelion's tutorials for socket programming and some other books but strange things happen in my programs.
I wrote a really simple client and server programs , and I make them work at this order:
1. Connect server.
2. Connect client (A connection is reported).
3. Disconnect client
4. Disconnect server.
5. Connect server.
6. Connect client. (now there is no connection of some strange reason).

I can't understand why doesn't it work in the second time. if I close the programs and reopen them it will work , but If I just push invoke a close socket call and then try again it won't work. I was told to use some flag called SOCKET REUSE or something similar but it didn't change much.

It might not be directly related to masm but I just hoped someone knows how to fix it.
Thanks,
realcr.
Title: Re: different behaviour on restart
Post by: realcr on March 16, 2006, 02:02:34 PM
I can't believe I found the problem after such a long time looking for it...
I tried using closesocket instead of close and now it works.
This is really strange ,as I was sure both of these functions had the same implementation under windows. (At least in linux it worked that way).

realcr.