new IO::Socket::INET + UDP/Broadcast = Permission denied ?? Why?

Discussion in 'Perl Misc' started by Snail, Mar 9, 2005.

  1. Snail

    Snail Guest

    The Following code works fine on my Win32 based system (with the server
    part running on the Linux system)...

    ##------------------------------------------------------------------------------
    #!/usr/local/bin/perl -w
    use strict;
    use vars qw/$sock $msg/;

    use IO::Socket;

    my $app_mode = $ARGV[0] || '-c';

    if (lc($app_mode) eq '-c') {
    print "Entering Client mode...\n\n";

    $sock = new IO::Socket::INET(
    LocalHost => '0.0.0.0', # Manually set the client's origion
    addr/port
    LocalPort => '3051',
    PeerAddr => '192.168.0.255',
    PeerPort => '3050', # Port the udp server listens on
    Proto => 'udp',
    Broadcast => 1 # Not sure if this is needed, I know the sockopt is
    ) || die "[ERROR] $!\n";
    $sock->sockopt(SO_BROADCAST, 1);
    print $sock "test\n";
    }

    # [snipped rest]
    # ('else' it acts as a server lisening on UDP port 3050.)
    ##------------------------------------------------------------------------------

    But on my linux system (RH 7.3) I get "permission denied" from $! when I
    try to create the socket. (Running the server part on the Win32 box,
    though the lcient on the linux never gets passed the "new
    IO::Socket::INET" statement.

    $ ./udptest.pl -c
    Entering Client mode...

    [ERROR] Permission denied

    And I tried logging in as root (su - root and even hitting alt+ctrl+F1
    and lgging in as root from there.) Either way I get the same result.

    Is there a simple way around this, without enabling something in the
    kernel or so, as I want this program to send to an entire network and be
    portable.

    Thanks for any help.
     
    Snail, Mar 9, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    5,813
  2. Replies:
    0
    Views:
    467
  3. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,250
    Smokey Grindel
    Dec 2, 2006
  4. ten8ciousb

    can't locate method new IO::Socket::INET

    ten8ciousb, Sep 28, 2006, in forum: Perl Misc
    Replies:
    5
    Views:
    356
    Bart Van der Donck
    Oct 2, 2006
  5. DJ Stunks
    Replies:
    11
    Views:
    498
Loading...

Share This Page