PHP Code:
// Partial Code

SOCKADDR_IN saServer;
    
saServer.sin_family AF_INET;
saServer.sin_addr = *((LPIN_ADDR)*ServerConversion->h_addr_list);
saServer.sin_port htons(80);

SomeVal connect(theSocket, (LPSOCKADDR)&saServersizeof(struct sockaddr)); 
Ok I need some help here guys.. I'm trying to get this to check if it's connected or not. Now if I try to connect to a server that doesn't exist the program crashes. Any ideas on that? Also, how would I go about checking if it's connected?

I tried this just to test out and I still crashed..

PHP Code:
if(SomeVal==WSAECONNREFUSED)
 {
  
MessageBox (NULL"Could Not Connect" "Error"0);
 }
  
MessageBox (NULL"Hi" "Success!"0); 
Could use some help, thanks in advance.