lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] sending data from spartan3 to another


From: Bernhard Wiegel
Subject: Re: [lwip-users] sending data from spartan3 to another
Date: Wed, 04 Feb 2009 11:06:23 +0100
User-agent: Thunderbird 2.0.0.19 (Macintosh/20081209)

Hi Devesh,

the limitations of lwip are definetly not 24Bytes for a data segement.
I am not using a Spartan3 as hardware but with the STR912 we are using here we can definetly transfer data segements which is larger than our MTU. In our case the MTU is 1500bytes for ethernet. If the data is larger than the MTU the tcp_sent callback will transmit the next portion of the data which is still left.

From your code snippet I can not tell what is going wrong.
The only strange thing is that you calculate the size of your data via strlen. This will not work if your data contains bytes with value of 0.
But from my point of view longer strings should be transmitted as well.

Are you sure that your interface to the ethernet ( I assume this is the transport medium you use) works correct? There could be data loss as well. Are packets with larger payload transmitted? If they are not transmitted: Is the data even received by the interface driver or not?

How did you set up lwip? To what value is your TCP_SND_BUF set?

Maybe that helps you tracing your problems a bit more...

Regards,
Bernhard


devesh schrieb:
Hi all,

Thanks for previous responses!!

I have been facing a problem as I told earlier. I want to send an 2-D
array of 128X128 (say:char img[128][128]) from one Spartan board to
another. I am able to send 32bytes with the following code. But at
receiving end, I got 24bytes(8 bytes are being lost) only. When i
exceed from 32,I get nothing.
So I concluded that the max bytes can be transferred are 24. But how
can I send 128X128? Through loop?
Well, I am using RAW api of LWIP and edk on WinXP

//FROM SENDER
static err_t client_connected(void *arg, struct tcp_pcb *pcb, err_t err)
{
   int i;
   char test[32];
   //char *string = "Hello!";
   char LWIP_UNUSED_ARG(arg);

   for(i=0;i<32;i++)
   {
        test[i]='1';
   }
   test[i-9]='A';
   test[32]='\0';
   xil_printf("The Payload is %s \n\r",test);
   if (err != ERR_OK)

printf("\nclient_connected(): err argument not set to ERR_OK, but is
value is %d\n", err);

   else
   {
       tcp_sent(pcb, client_sent);
       tcp_write(pcb, test, strlen(test), 0);
   }

   return err;
}

//FROM RECEIVING SIDE
err_t recv_callback(void *arg, struct tcp_pcb *tpcb,
                               struct pbuf *p, err_t err)
{

        /* do not read the packet if we are not in ESTABLISHED state */
#if 0
        if (tpcb->state >= 5 && tpcb->state <= 8) {
                tcp_close(tpcb);
                if (p)
                        pbuf_free(p);
                //xil_printf("Connection (%d) closed\n\r", (int)(arg));
                return;
        } else if (tpcb->state > 8)
                return;
#else
        if (!p) {
                tcp_close(tpcb);
                tcp_recv(tpcb, NULL);
                return ERR_OK;
        }
#endif

        /* indicate that the packet has been received */
        tcp_recved(tpcb, p->len);
        int n=32;
        /* echo back the payload */
        /* in this case, we assume that the payload is < TCP_SND_BUF */
        if (tcp_sndbuf(tpcb) > p->len) {
                char testing[100];
                strncpy(testing, p->payload,p->len);
                testing[p->len]='\0';
                xil_printf("The actual Payload is %s\n\r",p->payload);
                xil_printf("The Payload is %s \n\r",testing);
                xil_printf("The Payload on %d is %c \n\r",n-9,testing[n-9]);
                xil_printf("The Reference is %d\n\r",p->ref);
                xil_printf("The Length of packet is %d\n\r",p->len);
                xil_printf("Remote Port Number :: %d\n\r",tpcb->remote_port);
                xil_printf("Local Port Number :: %d\n\r",tpcb->local_port);
                err = tcp_write(tpcb, p->payload, p->len, 1);
        } else
                print("no space in tcp_sndbuf\n\r");

        /* free the received pbuf */
        pbuf_free(p);

        return ERR_OK;
}

Now what I get:
on sender
Input string -
The Payload is : 1111111111111111111111A11111111

on receiver:
output -
The actual Payload is : 1111111111111111111111A
The Payload is : 111111111111111111111A
The Payload on 23 is A

I want to know what are the limitation of LWIP? And can size of
TCP_SND_BUF be changed?

Please help me out!!!
Regards,
Devesh


_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users




--
Dipl-Ing Bernhard Wiegel

Universität Ulm - Ulm University
Institut für Organisation und Management von Informationssystemen (OMI) - 
Institute for Information Resource Management

Albert-Einstein-Allee 43
89081 Ulm, Germany Tel: +49 731 - 50 28788
Fax: +49 731 - 50 28789
E-Mail: address@hidden





reply via email to

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