[Israel.pm] problem with send()
semuel at semuel.co.il
Mon Jan 9 17:08:10 PST 2006
Are you sure that the DHCP protocol is working on UDP and not on ICMP or
something like that?
(If I got the protocol name a bit wrong, it's because my memory on there
protocols is totally rusty)
because if it works on ICMP, opening a UDP socket won't do you any good.
From: perl-bounces at perl.org.il [mailto:perl-bounces at perl.org.il] On
Behalf Of Levenglick Dov-RM07994
Sent: Monday, January 09, 2006 2:45 PM
To: 'perl at perl.org.il'
Subject: [Israel.pm] problem with send()
I am constantly getting this message "couldn't send DHCP reply (Unknown
error)" from the attached script. Does anyone know how I can get some
more information on why this is failing? I assume that it is to do with
the fact the socket is not connected; however I can't connect to a DHCP
client since its IP address has not yet been assigned.
If I am totally off track, please tell me. Either way, HELP!!!
my $sock = IO::Socket::INET->new(
LocalAddr => '184.108.40.206',
LocalPort => 67,
Proto => "udp",
Broadcast => 1
) or die "socket: $@";
# wait for DHCP request to come in
my $req = Net::DHCP::Packet->new($msg);
# create DHCP reply
my $dhcp_reply = Net::DHCP::Packet->new(
op => Net::DHCP::Packet::BOOTREPLY(),
htype => 1,
hlen => 6,
ciaddr => '220.127.116.11',
yiaddr => '18.104.22.168',
siaddr => '22.214.171.124',
file => 'tftp_file',
xid => $req->getOption('xid'),
flags => 0x0000,
# send DHCP reply
$sock->send($dhcp_reply->serialize(), MSG_DONTROUTE ) or die "couldn't
send DHCP reply ($!)\n";
DSP SoC System and Applications Engineer,
Network and Computing Systems Group
Freescale Semiconductor Israel
The information contained in this email is classified as:
[ ] General Business Information
[ ] Freescale Internal Use Only
[ ] Freescale Confidential Propriety
[x] Personal Memorandum
Perl mailing list
Perl at perl.org.il
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.15/223 - Release Date:
More information about the Perl