[Israel.pm] problem with send()

Levenglick Dov-RM07994 Dov at freescale.com
Mon Jan 9 04:45:22 PST 2006


Hi,
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!!!


#!/usr/local/bin/perl5.6.1

use strict;
use warnings;
use IO::Socket::INET;
use Net::DHCP::Packet;
use Net::TFTPd;

my $msg;
my $sock = IO::Socket::INET->new(
	LocalAddr => '223.31.95.191',
	LocalPort => 67, 
	Proto => "udp", 
	Broadcast => 1
) or die "socket: $@";

# wait for DHCP request to come in
$sock->recv($msg, 1024);
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 	=> '223.31.95.200',
	yiaddr 	=> '223.31.95.191',
	siaddr 	=> '223.31.95.191',
	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";

 
Best Regards,
Dov Levenglick
DSP SoC System and Applications Engineer,
Network and Computing Systems Group
Freescale Semiconductor Israel
Tel. +972-9-952-2804
The information contained in this email is classified as:
[ ] General Business Information
[ ] Freescale Internal Use Only
[ ] Freescale Confidential Propriety
[x] Personal Memorandum
 





More information about the Perl mailing list