function sendsockreply($fun, $msg, $tmo = false) { $ret = false; $socket = getsock($fun, $tmo); if ($socket !== false) { $ret = dosend($fun, $socket, $msg); if ($ret !== false) { $ret = readsockline($fun, $socket); } socket_close($socket); } return $ret; }
function sendsockreply($fun, $msg, $tmo = false) { global $fld_sep, $val_sep, $alrts; $ret = false; $socket = getsock($fun, $tmo); if ($socket !== false) { $ret = dosend($fun, $socket, $msg); if ($ret !== false) { $ret = readsockline($fun, $socket); } socket_close($socket); } $al = $fld_sep . 'alert' . $val_sep; if ($ret !== false and strpos($ret, $al) !== false) { $all = explode($al, $ret); $ret = $all[0]; $skip = true; foreach ($all as $lrt) { if ($skip) { $skip = false; } else { // Discard duplicates $alrts[preg_replace("/[\n\r]*\$/", '', $lrt)] = 1; } } } return $ret; }