C Board  

Go Back   C Board > General Programming Boards > Networking/Device Communication

Reply
 
LinkBack Thread Tools Display Modes
Old 08-27-2009, 05:36 AM   #1
Registered User
 
Join Date: Dec 2007
Location: France
Posts: 396
Close multiple sockets

Is it ok close two sockets like this?
The compiler telling me that the second one has no effect.

Code:
closesocket(client), (server);
or the standard way:

Code:
closesocket(client);
closesocket(server);
__________________
Using Code::Blocks,MingW with Windows.
Ducky is offline   Reply With Quote
Old 08-27-2009, 05:48 AM   #2
Guest
 
Sebastiani's Avatar
 
Join Date: Aug 2001
Posts: 4,923
Quote:
Originally Posted by Ducky View Post
Is it ok close two sockets like this?
The compiler telling me that the second one has no effect.

Code:
closesocket(client), (server);
or the standard way:

Code:
closesocket(client);
closesocket(server);
That's because the first set of statements are equivalent to:

Code:
closesocket(client);
server;
Hence, no effect.
Sebastiani is offline   Reply With Quote
Old 08-27-2009, 05:53 AM   #3
Registered User
 
Join Date: Dec 2007
Location: France
Posts: 396
So we cannot close two sockets with one function.

Thank you!
__________________
Using Code::Blocks,MingW with Windows.
Ducky is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
TCP Sockets: multiple clients - one server Printisor C Programming 4 11-01-2007 10:34 AM
multiple connections via sockets cope Networking/Device Communication 7 06-07-2007 10:35 AM
multiple UDP sockets with select() nkhambal Networking/Device Communication 2 01-17-2006 07:36 PM
Sockets, Multiple I/O _Cl0wn_ C Programming 3 03-18-2003 03:53 PM
Ghost in the CD Drive Natase A Brief History of Cprogramming.com 17 10-12-2001 05:38 PM


All times are GMT -6. The time now is 01:26 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22