in reply to Re^2: Net::Server only sends 128bytes at a time
in thread Net::Server only sends 128bytes at a time

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.

Replies are listed 'Best First'.
Re^4: Net::Server only sends 128bytes at a time
by alager (Acolyte) on Dec 17, 2009 at 22:38 UTC
    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

      Well, what about this example:

      #include <stdio.h> #include <sys/socket.h> #include <netinet/in.h> #include <err.h> #include <string.h> int main() { int s, c; struct sockaddr_in sa; char buf[1024]; s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); if (s < 0) err(1, "can't create socket"); sa.sin_family = AF_INET; sa.sin_port = htons(7777); sa.sin_addr.s_addr = INADDR_ANY; if (bind(s, (struct sockaddr *) &sa, sizeof(sa)) < 0 || listen(s, 10) < 0) err(1, "can't bind"); c = accept(s, NULL, NULL); memset(buf, 'x', 1024); send(c, buf, 1024, 0); return 0; }
      if it also divides packets on 128 bytes chunks, it is nothing to do with perl and you better ask for help on http://ubuntuforums.org

      Ah! Win=256 -- the window size is too small. Is this only for first segment or all segments are 128 bytes?

Re^4: Net::Server only sends 128bytes at a time
by alager (Acolyte) on Dec 18, 2009 at 16:42 UTC
    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

      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,

      Everyone can see unapproved nodes. That setting simply controls whether they're shown in Seekers of Perl Wisdom and similar.

      Perhaps what you want is to increase the reply depths (see the bottom of User Settings). If that's the problem, you can also see the "missing" nodes by viewing a less distant ancestor than the root node of the thread.

      Window size is the maximum amount of data that you can send to the peer. In this case by setting window to 256 your device shows that it ready to receive 256 bytes of data starting from seq=0.

        Just closing out this thread.
        Yes it was the window setting. I had set it to a define that seemed correct, RX_BUFFER, but this was for the serial port, and it was indeed 256.
        Setting WIN to it's max, I can now get much larger chunks of data through.

        Thanks,
        Aaron