Socket and pack problems. $ Message & nbsp ;=& nbsp; ''; $ message & nbsp ;. = & nbsp; pack ("a99", & nbsp; $ mail); $ message & nbsp ;. = & nbsp; pack ("a32", & nbsp; $ pas socket and pack problems.
$message = '';
$message .= pack("a99", $mail);
$message .= pack("a32", $pass);
$message .= pack("a19", $action);
$from = '';
$port = 0;
//echo $message;
if ($socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP))
{
//socket_bind($socket, '127.0.0.1', 27015);
socket_sendto($socket, $message, strlen($message), 0, $server_ip, $server_port);
$ret = socket_recvfrom($socket, $result, 12, MSG_WAITALL, $from, $port);
}
Failed to send the UDP struct using this code. it is okay to comment out the pack and execute it again.
Socket_sendto fails to be sent. the other party cannot receive the message and no data is returned. --
How does UDP send a struct?
------ Solution --------------------
In this case, I need to make an acceptor to listen
I want to say it's okay. do you believe it?