Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

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.

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]
[Copacetic]: Sorry, I've just discovered that it gives a useful error message if I select "preview" (as well as removing the "create" button for some reason). It was that my title wasn't long enough. Thanks for your help.
[choroba]: :-)

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (10)
As of 2017-05-26 15:18 GMT
Find Nodes?
    Voting Booth?