I'm wondering is there a function out there that would tell if the socket connection is still alive(or connected).
basically I use some of this to connect to the other "station" ( don't know if these code below would help,but I just want you to know)
Currently the programs works fine,it is able to retreive and process message from the other "station" (w/c acts a workspaceserver).Code:gethostbyname(HOST) //.............. clientService.sin_addr=*((struct in_addr*)h->h_addr); /* IP address for hostname */ clientService.sin_port = htons("4040"); /* smtp port */ clientService.sin_family = AF_INET; /* internet */ //................ ConnectSocket = socket(AF_INET, SOCK_STREAM, 0); connect( ConnectSocket, (struct sockaddr*) &clientService, sizeof(struct sockaddr) ) //...................
The problem is that when I disconnect my pc from the network (by pulling out the network cable), the program still run as if it is still connected to the other "station".
How do I check if the connection is still alive?