Here is what I currently have.
$host = "100.100.100.100";
$port = 21572;
//Open a client connection
$fp = fsockopen($host, $port, $errno, $errstr);
if (!$fp){
$result = "Error: Could not open socket connection";
}else{
//Write the user string to the socket
fputs ($fp, $output, strlen($output));
socket_set_timeout($fp, 30);
//Get Respones
//Get first five bytes to determine full size
$result = fread($fp, 5);
$bytes_left = socket_get_status($fp);
//Get the remaining results with known byte size
$result .= fread($fp, $bytes_left["unread_bytes"]);
//close the connection
fclose($fp);
}
This currenly works, but the server I am contacting would like me to have the socket open at all times. Therefore I need to send data to the already open socket.
Thanks in advance,