[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] sending data from spartan3 to another
From: |
devesh |
Subject: |
[lwip-users] sending data from spartan3 to another |
Date: |
Wed, 4 Feb 2009 11:50:47 +0530 |
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] sending data from spartan3 to another,
devesh <=