> 8; $siz .= chr($sen % 256); $sen = $sen >> 8; $siz .= chr($sen % 256); $sen = $sen >> 8; $siz .= chr($sen % 256); $msg = $siz . $msg; $left = $len + 4; while ($left > 0) { $res = socket_write($socket, substr($msg, 0 - $left), $left); if ($res === false) { $sockerr = socket_strerror(socket_last_error()); $msg = "$fun() sendsock() failed"; error_log("CKPERR: $msg '$sockerr'"); break; } else $left -= $res; } if ($left == 0) $ret = true; return $ret; } # function sendsock($fun, $msg) { $ret = false; $socket = getsock($fun); if ($socket !== false) { $ret = dosend($fun, $socket, $msg); socket_close($socket); } return $ret; } # function sendsockreply($fun, $msg) { $ret = false; $socket = getsock($fun); if ($socket !== false) { $ret = dosend($fun, $socket, $msg); if ($ret !== false) $ret = readsockline($fun, $socket); socket_close($socket); } return $ret; } # ?>