Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
When I send a burst of messages to the server I see some packets being dropped (netstat -su), I wanted to see how it works when I do the same in C and used This C program . When I run the C version it does not drop any message.
I thought the Perl socket used the underlying C libraries, So why does the perl version drop so many packets while the C version does not. Is there any way to make the perl version faster ?.
Thanks#!/usr/bin/perl =head1 NAME udp_server.pl - Simple sample udp echo server =head1 SERVER SYNOPSIS perl udp_server.pl --log_level 3 # default is to not background =cut package MyUDPD; use strict; use warnings; use Data::Dumper; my $port =32000; my $host = '0.0.0.0'; my $recv_length = 8192; # packet size use base qw(Net::Server::PreFork); ### run the server MyUDPD->run( port => "$host:$port/udp", min_servers => 10, ); exit; sub configure_hook { my $self = shift; ### change the packet len? $self->{server}->{udp_recv_len} = $recv_length; # default is 4096 } sub process_request { my $self = shift; my $prop = $self->{'server'}; print STDOUT $prop->{'udp_data'}; return; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl Socket Speed
by bluescreen (Friar) on Jun 28, 2010 at 23:50 UTC | |
by Anonymous Monk on Jun 29, 2010 at 01:33 UTC |