Markus wrote:
Hi all,
have someone a idea how to generate UPD packets and send out on a Ethernet
adapter without a established session.
I need this to generate RIP routes generation.
The default destination definition are:
* source IP equal the own IP interface,
* destination IP 224.0.0.9,
UDP port 520 in source and destination.
Thanks in advance
markus
Here is an example from the perl cookbook
#!/usr/bin/perl -w
# udpmsg - send a message to the udpquotd server
use IO::Socket;
use strict;
my($sock, $server_host, $msg, $port, $ipaddr, $hishost,
$MAXLEN, $PORTNO, $TIMEOUT);
$MAXLEN = 1024;
$PORTNO = 5151;
$TIMEOUT = 5;
$server_host = shift;
$msg = "@ARGV";
$sock = IO::Socket::INET->new(Proto => 'udp',
PeerPort => $PORTNO,
PeerAddr => $server_host)
or die "Creating socket: $!\n";
$sock->send($msg) or die "send: $!";
eval {
local $SIG{ALRM} = sub { die "alarm time out" };
alarm $TIMEOUT;
$sock->recv($msg, $MAXLEN) or die "recv: $!";
alarm 0;
1; # return value from eval on normalcy
} or die "recv from $server_host timed out after $TIMEOUT seconds.\n";
($port, $ipaddr) = sockaddr_in($sock->peername);
$hishost = gethostbyaddr($ipaddr, AF_INET);
print "Server $hishost responded ``$msg''\n";
--
Bob Davis | Senior Advisory Software Developer - Applications
[EMAIL PROTECTED]
Work: 603-926-9696 x3456
Home: 603-778-0781
Aim: dad1732
Yim: rsdavis9
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs