Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Simple UDP example anyone?

by chromatic (Archbishop)
on Dec 05, 2001 at 11:27 UTC ( [id://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!'

IO::Socket
by Ea (Chaplain) 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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-03-29 13:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found