Listing 5: The client socket structure definitions
// file sloc.c #include "stdhead.h" #include "flsocket.h" #include "ipcomm.h" #include "sloc.h" #include "socloc.h" #include "slconfig.h" #include "sconnect.h" #ifdef OS_WIN32 SOCKET slclientSocket; SOCKADDR_IN sockClientAddr; LPHOSTENT lpHostEnt; #endif #ifdef OS_UNIX int slclientSocket; struct sockaddr_in sockClientAddr; struct hostent *lpHostEnt; #endif char sloc_hostname[128]; int sloc_port = 0; int spos; int staleport[25]; int splimit = 25; int has_failover = FALSE; int sloc_initialize(void) { char hname[SL_MAXCOMMAND]; int ret, port; if ((ret = sl_config_read(SL_CONFIG_FILE_NAME)) != SL_OK) return(ret); if ((ret = sl_config_get_first(hname, &port, (char *)NULL)) != SL_OK) return(ret); strcpy(sloc_hostname, hname); sloc_port = port; if ((ret = sloc_status()) != SL_OK) return(ret); return(SL_OK); }