Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: Simple UDP example anyone?

by chromatic (Archbishop)
on Dec 05, 2001 at 11:27 UTC ( #129545=note: print w/ replies, xml ) Need Help??

in reply to Simple UDP example anyone?

Recipe 17.5 of the Perl Cookbook is handy:

use IO::Socket; use strict; my $sock = IO::Socket::INET->new( Proto => 'udp', PeerPort => 5000, PeerAddr => 'hostname', ) or die "Could not create socket: $!\n"; $sock->send('a file to have your advice') or die "Send error: $!\n";
perlipc has other examples. IO::Socket is slightly easier than Socket, and translating between the two isn't terribly difficult.

Comment on Re: Simple UDP example anyone?
Download Code
Replies are listed 'Best First'.
Re: Re: Simple UDP example anyone?
by mitd (Curate) on Dec 05, 2001 at 14:54 UTC
    $sock->send('a file to have your advice')
    Now thats what I call a datagram with a message.

    lol, chromatic++

    mitd-Made in the Dark
    'Interactive! Paper tape is interactive!
    If you don't believe me I can show you my paper cut scars!'

by Ea (Hermit) on Dec 05, 2001 at 16:44 UTC
    What few people mention is that IO::Socket doesn't work under Solaris (I believe that Sun has hardcoded the constants to non-standard values or similar rubbish) and you get stuck with using Socket

    Ea :wq

      IO::Socket actually does work under Solaris. I've been using it for XML servers on 4 different Solaris boxes ranging from 5.6 to 5.8. It's actually really sweet.
        I actually have done the same, and have successfully coded many a daemon to run on solaris systems. Sun can be very nice to you when you learn to use it.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://129545]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2015-12-01 11:20 GMT
Find Nodes?
    Voting Booth?

    My keyboard shows this many letters:

    Results (0 votes), past polls