ext/sockets socket_sendto() 5th param cannot be hostname
| From: | Richard Samar | Date: | Fri, 15 Feb 2002 23:18:46 +0000 |
| Subject: | ext/sockets socket_sendto() 5th param cannot be hostname | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-80086@lists.php.net to get a copy of this message | ||
Hi,
yeah ext/sockets again :-)
The 5th param of socket_sendto() obviously cannot be a hostname
(string). socket_bind(), socket_connect() etc. allow this though.
So I am not sure wether it is wanted or not. But I guess it is :-)
For socket_sendto() though one would need to use
gethostbyname ("my.host.com") and use its returnvalue as the
5th param to socket_sendto() or directly use a dotted-decimal
notation.
chaning:
if (inet_aton(addr, &addr_buf) == 0) {
sin.sin_addr.s_addr = addr_buf.s_addr;
} else {
to (omitting "== 0"):
if (inet_aton(addr, &addr_buf) ) {
sin.sin_addr.s_addr = addr_buf.s_addr;
} else {
allows to use also hostname.
I read that inet_aton() returns a pointer to char and not 0
on success, so that might be the reason why it won't work like
the way it is momently.
As my karma is insufficent for these parts, maybe someone can make
the mini-fix again :-) ...maybe jason again? ...would be very kind.
thx and best regards
-moh