Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

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
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 (Friar) 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
Node Status?
node history
Node Type: note [id://129545]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (7)
As of 2014-09-19 23:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (151 votes), past polls