DNS Connection Question
Bob Gorman
bob at rsi.com
Wed Oct 20 09:19:00 EDT 2004
At 10:14 PM 10/19/2004, trlists at clayst.com wrote:
>They're right -- and it is possible to use a PHP fsockopen() with UDP
>but it's more complex as then you have to listen for the answer etc.
>It will make things trickier.
I use socket_create() and related functions:
http://www.php.net/manual/en/function.socket-create.php
You might also want to spend some time learning the DNS protocol:
http://www.networksorcery.com/enp/protocol/dns.htm
Let me know if you need any PHP or other systems help.
<?php
$res = @socket_create(AF_INET, SOCK_STREAM, getprotobyname('udp'));
if ($res === FALSE) {
$errcode = @socket_last_error();
$errtext = socket_strerror($error_code);
echo 'socket_create() failure.' . "\n";
echo 'Error code is: ' . $errcode . "\n";
echo 'Error text is: ' . $errtext . "\n";
@socket_clear_error();
die();
}
$socket = $res;
?>
--
I create custom Linux business solutions in the Boston area.
mailto:bob(at)rsi.com, http://www.rsi.com/, 617.965.1700
More information about the Discuss
mailing list