C Board  

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

Reply
 
LinkBack Thread Tools Display Modes
Old 10-09-2005, 11:18 AM   #1
Never Exist
 
Hermitsky's Avatar
 
Join Date: Jul 2004
Posts: 149
Question Need help with winsock2

i am doing a server/client program with winsock2. once a client starts, it will connect to server and send some info. after server got these info,the connection will be closed,and the server will waiting for another client.

now i wanna make sure that, once the server-socket accept a connection,this connection won't last more than 10 seconds. if one connection lasts more than 10 seconds,then the server-socket should close the connection automatically. is there anyway to set that time limit? any suggestion would be greatly appreciated.......
__________________

blow me ... ...
Hermitsky is offline   Reply With Quote
Old 10-09-2005, 01:12 PM   #2
Unregistered User
 
Join Date: Sep 2005
Location: Antarctica
Posts: 341
you can set read and write timeouts, but if you want to limit the connection time to 10 seconds, you will need to do something like spawn a separate thread for each connection, have it sleep 10 seconds and then close the socket if it hasn't been closed yet.
rockytriton is offline   Reply With Quote
Old 10-16-2005, 07:51 AM   #3
Never Exist
 
Hermitsky's Avatar
 
Join Date: Jul 2004
Posts: 149
Thanks, rockytriton.

one more question: how to set the read time-out ?
__________________

blow me ... ...
Hermitsky is offline   Reply With Quote
Old 10-16-2005, 12:42 PM   #4
Registered User
 
Join Date: Sep 2004
Location: California
Posts: 3,020
setsockopt()
bithub is offline   Reply With Quote
Old 10-16-2005, 04:48 PM   #5
Never Exist
 
Hermitsky's Avatar
 
Join Date: Jul 2004
Posts: 149
thanks guys .....
__________________

blow me ... ...
Hermitsky is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cross Network communication using Winsock2? dp_76 Networking/Device Communication 6 05-20-2005 07:05 AM
connecting to ftp server (winsock2) commissar C++ Programming 1 03-03-2005 10:22 AM
Linker errors on Winsock2 functions ShadowMetis C++ Programming 2 11-20-2004 11:19 PM
cant use winsock2 in dev-c++ datainjector Tech Board 2 08-30-2003 03:55 PM
Strange MSVC winsock2 compile error LuckY Windows Programming 3 06-28-2003 08:18 AM


All times are GMT -6. The time now is 10:29 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

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