lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] Problem receiving large packets


From: feroz
Subject: [lwip-users] Problem receiving large packets
Date: Sun, 05 Feb 2006 15:26:03 +0100
User-agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)

Hello,

Im having problems receiving properly large packets.
I'm trying to a receive file using lwip. this is my callback function:

err_t serv_recv(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
{
   err_t ret_code = ERR_OK;
   unsigned char *c = p->payload;
   unsigned int cnt=0;
   int ret;

  if(ERR_OK == err)
   {
       if(p != NULL)
       {
           for(cnt=0;cnt<p->tot_len;cnt++)
               xil_printf("%c", *(c+cnt));
print("\n\r"); if(*c == 'q' && *(c+1) == 'u' && *(c+2) == 'i' && *(c+3) == 't' && p->tot_len == 4)
               {
                   serv_close(pcb);
               }
           tcp_recved(pcb, p->tot_len);
           pbuf_free(p);

           ret=tcp_write(pcb, "a", 1, 1);
           tcp_sent(pcb, NULL);
       }
       else if(p == NULL)
       {
           serv_close(pcb);
       }
   }
   else
   {
       ret_code = err;
   }
   return ret_code;
}

On the other side, as client i use a small script that is sending string for now.

my $port = 7;
my $server = "193.51.45.84";

socket(SH, PF_INET, SOCK_STREAM, getprotobyname('tcp')) || print "socket() failed: $!\n";

my $sin = sockaddr_in ($port,inet_aton($server));
print "Connecting...\n";
connect(SH,$sin) || die "connect() failed: $!\n";
syswrite(SH, "hello", 5);
sysread(SH, $line, 1);
my $a = 'a' x 600;
syswrite(SH, $a, length($a));
sysread(SH, $line, 1); << Never get a char back when the string i send is larger than 600 chars

My problem is that as long as i send a string shorter than 600 chars everything seems to be ok, but when sending larger strings, i dont get the "a" char i send after receiving something. So the program waits for that on the last sysread on the client side.
Is there anything i have done wrong?

Regards,
Feroz.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]