Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Net::Server only sends 128bytes at a time

by zwon (Abbot)
on Dec 17, 2009 at 20:33 UTC ( [id://813258]=note: print w/replies, xml ) Need Help??


in reply to Net::Server only sends 128bytes at a time

I just tried simple example and it sent me 1024 bytes in one packet. Could you show us your code?

  • Comment on Re: Net::Server only sends 128bytes at a time

Replies are listed 'Best First'.
Re^2: Net::Server only sends 128bytes at a time
by alager (Acolyte) on Dec 17, 2009 at 21:28 UTC
    Here is the data being sent between the single quotes:
    to client:'1:AAE/LxI1l9kvzveExnBSsku783Z+1mWYld/J7G3nl/OijlRXuIZXDKcHQ +DTlkIB52p/qxiFohG76Jxhb1F64oyPpom24PO7RVvKb4jQkOoi4xNbBwSbvMUsq1ZnqNP +95vz2ifeWzqqPmR9XRS7OfbgZSK8X3le/YP/Ca8Mj5K90aJ7oYF2HaeJFotVeCO9eLpS5 +zlH02gGMADCfS+ZXwN4420u/fwevNrBMx/cSeCVtcocS6i3wPNlJKA'
    It's base64 encoded binary data. Wireshark shows the data being truncated at 128 bytes around nqNP and 95vz

    And the section of code that sends it:

    my $sql="SELECT data FROM firmware_data WHERE firmware_key = '$firmwa +re_key' AND row_number = $current_row"; $self->log(4, "select: $sql"); $sth=$dbh->prepare($sql); $sth->execute; $firmware_packet=$sth->fetchrow(); $sth->finish(); if (defined($firmware_packet) ){ $IdleUserTimeout=0; #reset the timer since we got some user data $self->log(4,"firmware row: $current_row"); #send the data $self->log(4, "firmware to client:'$current_row:$firmware_packet'"); print "$current_row:$firmware_packet\r\n"; if ($current_row < $data_NumberOfRows){ $current_row++; #get the next packet net time around } if ($firmware_packet =~ /^#bye$/){ #we recived the BYE command, so inform the client and close the so +cket down log_user_out($self, $dbh, $MAC); return; } select(undef, undef, undef, .5); #500ms
    This is the line that sends the data, from above.
    print "$current_row:$firmware_packet\r\n";

    UPDATE: I'm using perl 5.8.8 on Ubuntu 8.04 LTS Server
    Linux 2.6.24-23-server

    Thanks for the help,
    Aaron

      I don't see problem here. I can suggest the following, first try my example and see if data will be sent by one chunk or will be divided onto several packets:

      #!/usr/bin/perl -w use strict; use warnings; package MyPackage; use base qw(Net::Server::PreFork); sub process_request { my $self = shift; print 'x' x 1024; } MyPackage->run( port => 7777 );
      Second, "firmware" makes me think that there's some device on the other end. Is it able to handle packets bigger than 128 bytes? Look if there's MSS option in SYN packet.
        I get the same thing with your code too.
        As can be seen from wireshark, the sending packets are set to 128bytes.
        Transmission Control Protocol, Src Port: atmp (5150), Dst Port: 53616 (53616), Seq: 129, Ack: 55, Len: 128

        I checked the buffers in my receiving software and it is set to 1400 bytes for Ethernet buffers.

        As for the MSS it's set as follows:
        TCP 53616 > atmp SYN Seq=0 Win=256 Len=0 MSS=1324
        and
        TCP atmp > 53616 SYN, ACK Seq=0 Ack=1 Win=5840 Len=0 MSS=1380
        Both are much bigger than 128.

        Aaron

        Something is wacky with this thread...I have the checkbox to "show unapproved nodes" set, but I still can't see the last three posts, or reply to them. Sorry for breaking the thread flow here.

        The window size is only 256 on the reply packets from my target device. The window size for the packets coming from my perl script, that are being broken down to 128 bytes, is 5840.
        TCP atmp > 53618 PSH, ACK Seq=104 Ack=105 Win=5840 Len=78

        I'll try your code and post back.
        Thanks,
        Aaron

        UPDATE: Looks like the same issue with your posted C code. I'm off to see the wizard. (somewhere else).
        Thanks for your help!
        Aaron

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-25 10:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found