Threadsafe Function DetectorSentinel() variable sock_sics, ii string msg,temp sock_sics=sockitopenconnectionF("137.157.202.139",60003,10) if(sockitisitopen(sock_sics)==-1) print "ERROR couldn't open sentinel sockets" endif do //read the info on the socket temp = SOCKITPeek(sock_sics) //see what the message means strswitch(temp) case "close it": break break case "send a different message": sockitsendmsgF(sock_SICS, "a message\n") break //send a message and get the result immediately. default: temp = sockitsendnrecvF(sock_SICS, "do something\n") break endswitch if(sockitisitopen(sock_sics)==-1) sock_sics=sockitopenconnectionF("137.157.202.139",60003,10) if(sock_sics==-1) print "ERROR sentinel socket closed" return 1 endif endif while(1) sockitcloseconnection(sock_SICS) return 0 End