atistler has asked for the wisdom of the Perl Monks concerning the following question:

I am having strange problem. I am running RH 7.3 2.4.23-V120203Gen #1. I have perl 5.6.1 installed and i believe my version of IO::Socket::INET is 1.27. This machine is serving as a syslog server recieving ALOT of syslog messages. I discovered that quite a few of the syslog msgs are missing when I write them to a file. I decided to not even write anything to file to eliminate IO write issues. Right now I am simply recv'ing on a socket and I get the following. Is there some sort of limit on how much data a socket can handle recv'ing. Would writing this in C/C++ make any difference??
#!/usr/bin/perl -w use IO::Socket::INET; my $sock = IO::Socket::INET->new( LocalAddr => 'loghost', LocalPort => 514, Proto => 'udp', Listen => '5' ) or die "Cant establish socket"; my $data = ''; while ( 1 ) { my $from_who = recv( $sock, $data, 1450, 0 ) || warn "Problem +with recv: $!\n"; }
bash-2.05a$ sudo ./sockettest.pl Problem with recv: Resource temporarily unavailable Problem with recv: Resource temporarily unavailable Problem with recv: Resource temporarily unavailable Problem with recv: Resource temporarily unavailable Problem with recv: Resource temporarily unavailable Problem with recv: Resource temporarily unavailable

Replies are listed 'Best First'.
Re: UDP Socket: Resource temporarily unavailable
by shmem (Chancellor) on Jul 25, 2006 at 10:53 UTC
    Erm... maybe a silly question: you do not run syslog, do you? If you run netstat -an | grep 514 and see a line like

    udp 0 0 0.0.0.0:514 0.0.0.0:*

    chances are there's a process already listening.

    --shmem

    update: it is a silly question; if there was, it would die "Cant establish socket"

    Set up the socket as DGRAM:

    my $sock = IO::Socket::INET->new( LocalAddr => 'loghost', LocalPort => 514, Proto => 'udp', Type => SOCK_DGRAM, # Listen => '5' # for SOCK_STREAM ) or die "Cant establish socket";
    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}