ext/sockets socket_recvfrom() 6th Parameter problem
| From: | Richard Samar | Date: | Fri, 15 Feb 2002 14:14:32 +0000 |
| Subject: | ext/sockets socket_recvfrom() 6th Parameter problem | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-80074@lists.php.net to get a copy of this message | ||
Hi,
I have a little problem with the behavior of socket_recvfrom().
Here the function entry:
PHP_FE(socket_recvfrom, second_fifth_and_sixth_args_force_ref)
In case you have an AF_INET socket the 6th param should be set.
Byref (see FE) a port is written into the 6th param:
ZVAL_LONG(arg6, ntohs(sin.sin_port));
before though following is done:
if (arg6 == NULL) {
WRONG_PARAM_COUNT;
}
So in PHP when I use:
$buffer = socket_recvfrom ($socket, $buffer, 1024, 0, $from_adress,
$from_port);
It gives me the error of "wrong param count" because $from_port is not
set yet and surely is NULL.
I could do:
$from_port = 0;
$buffer = socket_recvfrom ($socket, $buffer, 1024, 0, $from_adress,
$from_port);
$from_port is overriden anyways though and I am asking if there is
a more elegenat way to solve this either in socket.c or in PHP.
best regards
-moh