--- Quote Start ---
I have done the same. Since you probably do not send packets both ways (mostly TO the board), lwip waits for outgoing packets for some time before it ACKs a packet. You need to change the timeout for this counter, and you should also send an immediate reply for each packet.
Do the following in \altera\kits\nios2\components\altera_lwip\UCOSII\src\downloads\lwip-0.6.3\src\api\tcp.h:
# define TCP_FAST_INTERVAL 100
You should try other values as well.
Also, in tcp.c, change tcp_recved() to:
void
tcp_recved(struct tcp_pcb *pcb, u16_t len)
{
int ackNow=0;
if ((u32_t)pcb->rcv_wnd + len > TCP_WND) {
pcb->rcv_wnd = TCP_WND;
} else {
pcb->rcv_wnd += len;
ackNow=1;
}
if (!(pcb->flags & TF_ACK_DELAY) &&
!(pcb->flags & TF_ACK_NOW)) {
/*
* We send an ACK here (if one is not already pending, hence
* the above tests) as tcp_recved() implies that the application
* has processed some data, and so we can open the receiver's
* window to allow more to be transmitted. This could result in
* two ACKs being sent for each received packet in some limited cases
* (where the application is only receiving data, and is slow to
* process it) but it is necessary to guarantee that the sender can
* continue to transmit.
*/
tcp_ack(pcb);
}else if((pcb->flags & TF_ACK_DELAY)&&(ackNow)){
//++cg[11/10/2004]: I think this is what Atte Kojo was talking about
tcp_ack(pcb);
}
}
--- Quote End ---
Hello,
I am using Quartus II version 10.0sp1. I did not found the# define and the function you mentioned.
Can you advice me how can I achieve better data rates using TCP and simple socket server.
Your prompt response is highly appreciated.
Thanks & Regards