Register for your free account! | Forgot your password?

Go Back   elitepvpers Coders Den C/C++
You last visited: Today at 14:41

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Check if Socket is Connected?

Discussion on Check if Socket is Connected? within the C/C++ forum part of the Coders Den category.

Reply
 
Old   #1
 
Cøre's Avatar
 
elite*gold: 0
Join Date: Feb 2016
Posts: 94
Received Thanks: 22
Check if Socket is Connected?

Hallo,
Und zwar möchte ich eine Funktion schreiben, die checkt ob ein Socket Connected oder Disconnected ist.

Aber wie?

Danke im Vorraus
Cøre is offline  
Old   #2
 
EngelEatos's Avatar
 
elite*gold: 22
Join Date: May 2011
Posts: 516
Received Thanks: 178
Code:
int error_code;
int error_code_size = sizeof(error_code);
getsockopt(socket_fd, SOL_SOCKET, SO_ERROR, &error_code, &error_code_size);
(Quelle: )
erster ergebnis bei google
EngelEatos is offline  
Old   #3
 
Cøre's Avatar
 
elite*gold: 0
Join Date: Feb 2016
Posts: 94
Received Thanks: 22
Die ging nicht^^
Aber hab es.
mit select
Cøre is offline  
Old   #4
 
coladose's Avatar
 
elite*gold: 106
Join Date: Jun 2010
Posts: 2,256
Received Thanks: 3,867
Quote:
Default use of TCP doesn't allow very timely detection of dead sockets (outside of normal closure) so I'll suggest that an "is_connected" function like this is largely useless for all practical purposes. Consider implementing an application-layer keep-alive and track if it's alive based on timely responses (or lack thereof).
Source:
coladose is offline  
Reply


Similar Threads Similar Threads
Client check if server socket is open C#
10/21/2014 - CO2 Programming - 5 Replies
i want the client check if the server socket is online or not , and if it's not it's wait 20 sec then check again .. i tried to figure it out by making this code but still doesn't make what i want ... i think there is a good solution better than the one i made . public bool Connect(string IP, int Port) { int tries = 0; IPAddress ipAddress = IPAddress.Parse(IP); IPEndPoint ipEndPoint = new IPEndPoint(ipAddress, Port); while...
[SMALL TUT] How to check if your account is connected with bigpoint.com
02/21/2014 - DarkOrbit - 31 Replies
Everyone knows that there is a way to have access to your account even if you sell it to someone else - all you need is connect DarkOrbit account with bigpoint.com. But you may have BIG problem if you want to buy account from someone. To prevent any troubles there is an easy way to check if account is connected with bigpoint.com :) It's quite simple. All you have to do is LOGOUT from darkorbit account and see the 'logout screen'. If it looks like the following picture (2 buttons ->...



All times are GMT +2. The time now is 14:43.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.