raguram
(Raguramakrishnan M)
September 24, 2026, 8:58am
1
Hi
i am working on the atum3 terasic board using NiosV with FreeRTOS , where i am implementing WebServer application, basically Http Server is running on the board and http client on the linux host which is connected to the board.
Issue : i am sending 22Mbits of data from my board[ http server ] to host [ http or web client ] through ethernet. using tcp/ip format.
when i am sending 22Mbits of data 1st time , it finished it transfer in 3.5s But when did again [ i.e 2nd time ] it took 10.7 seconds , did again [ i.e 3rd time ] it took again 3.5s and 4th time it took 10.7 sec , so the transfer time is toggling between these two numer always .
point to note:
i opened the socket , send 4 time and close the socket , i see this toggling send time behaviour.
opened the socket , send 1 time , close the socket β always it is 3.5sec [ i done this procedure , almost 10 time , i always got 3.5sec ]
what is the problem so that i can stabilize the sent time , instead of toggling.
Thanks for your time.
You likely want to put Wireshark on the line to see what is happening. I suspect that somehow, when the socket is open for the longer time. something is happening to a packet and you end up waiting for a time-out, and the triggering condition gets reset by closing and opening the socket.
aggarg
(Gaurav Aggarwal)
September 26, 2026, 5:13pm
3
As @richard-damon suggested, you need to capture network traffic using Wireshark to see what is going on. Separately, why do you want to keep the socket open for long?
raguram
(Raguramakrishnan M)
September 28, 2026, 11:50am
4
@richard-damon @aggarg
i cant able to upload the pcap file here, tried to upload it in zip format, but it shows new user cant upload, is there any way to upload the files ?
I got the freeRTOS_Send ticktime to see whether the issue is from stack side or not
this is the output of fast and slow tick for freeRTOS_send API
1 : sendTicks: 28
2 : sendTicks: 28
3 : sendTicks: 28
4 : sendTicks: 27
5 : sendTicks: 28
6 : sendTicks: 28
7 : sendTicks: 28
8 : sendTicks: 27
9 : sendTicks: 27
10 : sendTicks: 28
11 : sendTicks: 28
12 : sendTicks: 27
13 : sendTicks: 27
14 : sendTicks: 27
15 : sendTicks: 27
16 : sendTicks: 27
17 : sendTicks: 28
18 : sendTicks: 28
19 : sendTicks: 28
20 : sendTicks: 27
21 : sendTicks: 27
22 : sendTicks: 28
23 : sendTicks: 27
24 : sendTicks: 27
25 : sendTicks: 28
26 : sendTicks: 27
27 : sendTicks: 27
28 : sendTicks: 27
29 : sendTicks: 28
30 : sendTicks: 27
31 : sendTicks: 27
32 : sendTicks: 28
33 : sendTicks: 27
34 : sendTicks: 27
35 : sendTicks: 27
36 : sendTicks: 27
37 : sendTicks: 28
38 : sendTicks: 27
39 : sendTicks: 27
40 : sendTicks: 27
41 : sendTicks: 28
42 : sendTicks: 28
43 : sendTicks: 27
44 : sendTicks: 27
45 : sendTicks: 27
46 : sendTicks: 27
47 : sendTicks: 27
48 : sendTicks: 27
49 : sendTicks: 27
50 : sendTicks: 28
51 : sendTicks: 27
52 : sendTicks: 27
53 : sendTicks: 28
54 : sendTicks: 27
55 : sendTicks: 27
56 : sendTicks: 28
57 : sendTicks: 27
58 : sendTicks: 27
59 : sendTicks: 27
60 : sendTicks: 27
61 : sendTicks: 27
62 : sendTicks: 27
63 : sendTicks: 27
64 : sendTicks: 27
65 : sendTicks: 28
66 : sendTicks: 27
67 : sendTicks: 27
68 : sendTicks: 27
69 : sendTicks: 27
70 : sendTicks: 27
71 : sendTicks: 27
72 : sendTicks: 27
73 : sendTicks: 27
74 : sendTicks: 27
75 : sendTicks: 28
76 : sendTicks: 27
77 : sendTicks: 28
78 : sendTicks: 27
79 : sendTicks: 27
80 : sendTicks: 27
81 : sendTicks: 27
82 : sendTicks: 27
83 : sendTicks: 27
84 : sendTicks: 27
85 : sendTicks: 28
86 : sendTicks: 28
87 : sendTicks: 27
88 : sendTicks: 27
89 : sendTicks: 27
90 : sendTicks: 28
91 : sendTicks: 28
92 : sendTicks: 27
93 : sendTicks: 27
94 : sendTicks: 28
95 : sendTicks: 28
96 : sendTicks: 28
97 : sendTicks: 27
98 : sendTicks: 27
99 : sendTicks: 28
100 : sendTicks: 27
101 : sendTicks: 27
102 : sendTicks: 27
103 : sendTicks: 27
104 : sendTicks: 27
105 : sendTicks: 28
106 : sendTicks: 27
107 : sendTicks: 28
108 : sendTicks: 28
109 : sendTicks: 27
110 : sendTicks: 27
111 : sendTicks: 27
112 : sendTicks: 27
113 : sendTicks: 27
114 : sendTicks: 27
115 : sendTicks: 28
116 : sendTicks: 28
117 : sendTicks: 27
118 : sendTicks: 27
119 : sendTicks: 11
SEND] calls=119 total_wait=3234 ms max_wait=28 ms zero=0 1-4ms=0 >=5ms=119 partial=0 failed=0 remaining=0
Elapsed time for sending : 3296 ms
1 : sendTicks: 83
2 : sendTicks: 90
3 : sendTicks: 90
4 : sendTicks: 90
5 : sendTicks: 90
6 : sendTicks: 90
7 : sendTicks: 89
8 : sendTicks: 90
9 : sendTicks: 89
10 : sendTicks: 90
11 : sendTicks: 90
12 : sendTicks: 90
13 : sendTicks: 89
14 : sendTicks: 89
15 : sendTicks: 89
16 : sendTicks: 89
17 : sendTicks: 89
18 : sendTicks: 89
19 : sendTicks: 89
20 : sendTicks: 89
21 : sendTicks: 89
22 : sendTicks: 89
23 : sendTicks: 89
24 : sendTicks: 89
25 : sendTicks: 88
26 : sendTicks: 88
27 : sendTicks: 88
28 : sendTicks: 88
29 : sendTicks: 88
30 : sendTicks: 89
31 : sendTicks: 88
32 : sendTicks: 88
33 : sendTicks: 88
34 : sendTicks: 88
35 : sendTicks: 88
36 : sendTicks: 88
37 : sendTicks: 88
38 : sendTicks: 88
39 : sendTicks: 87
40 : sendTicks: 88
41 : sendTicks: 88
42 : sendTicks: 88
43 : sendTicks: 88
44 : sendTicks: 89
45 : sendTicks: 88
46 : sendTicks: 88
47 : sendTicks: 88
48 : sendTicks: 88
49 : sendTicks: 89
50 : sendTicks: 88
51 : sendTicks: 88
52 : sendTicks: 88
53 : sendTicks: 87
54 : sendTicks: 88
55 : sendTicks: 88
56 : sendTicks: 88
57 : sendTicks: 88
58 : sendTicks: 88
59 : sendTicks: 88
60 : sendTicks: 88
61 : sendTicks: 87
62 : sendTicks: 88
63 : sendTicks: 88
64 : sendTicks: 88
65 : sendTicks: 88
66 : sendTicks: 88
67 : sendTicks: 88
68 : sendTicks: 88
69 : sendTicks: 88
70 : sendTicks: 88
71 : sendTicks: 88
72 : sendTicks: 88
73 : sendTicks: 88
74 : sendTicks: 88
75 : sendTicks: 88
76 : sendTicks: 88
77 : sendTicks: 88
78 : sendTicks: 88
79 : sendTicks: 88
80 : sendTicks: 88
81 : sendTicks: 88
82 : sendTicks: 88
83 : sendTicks: 88
84 : sendTicks: 88
85 : sendTicks: 88
86 : sendTicks: 89
87 : sendTicks: 88
88 : sendTicks: 88
89 : sendTicks: 88
90 : sendTicks: 88
91 : sendTicks: 88
92 : sendTicks: 89
93 : sendTicks: 88
94 : sendTicks: 88
95 : sendTicks: 88
96 : sendTicks: 88
97 : sendTicks: 88
98 : sendTicks: 88
99 : sendTicks: 88
100 : sendTicks: 88
101 : sendTicks: 89
102 : sendTicks: 89
103 : sendTicks: 88
104 : sendTicks: 88
105 : sendTicks: 88
106 : sendTicks: 88
107 : sendTicks: 89
108 : sendTicks: 89
109 : sendTicks: 89
110 : sendTicks: 89
111 : sendTicks: 88
112 : sendTicks: 89
113 : sendTicks: 89
114 : sendTicks: 89
115 : sendTicks: 89
116 : sendTicks: 89
117 : sendTicks: 90
118 : sendTicks: 90
119 : sendTicks: 33
SEND] calls=119 total_wait=10461 ms max_wait=90 ms zero=0 1-4ms=0 >=5ms=119 partial=0 failed=0 remaining=0
Elapsed time for sending : 10536 ms
raguram
(Raguramakrishnan M)
September 28, 2026, 12:01pm
5
and for fast transfer , the web client [ host ] is sending once ack for two packet , but slow transfer , almost host transfer 1:1 packet/ACK . this info i got from the wireshark tcpdump
raguram
(Raguramakrishnan M)
September 28, 2026, 12:05pm
6
@aggarg
the reason for long time socket open is , the application is connected to web page through http/1.1 so , my application need to send data to web till user want to disconnect from page.
is there any problem occurs if we open the socket for long time ?
aggarg
(Gaurav Aggarwal)
September 29, 2026, 5:23am
8
You should now be able to upload files.
Should not happen. Can you share the code which sends data?
raguram
(Raguramakrishnan M)
September 29, 2026, 5:36am
9
fast-slow.zip (367.5 KB)
@aggarg @richard-damon tcp dump of the transfers.
note: it is single connection , where i took a 4 tcpdump for fast and slow transfer
after the connnection ,
transfer-1 β fast-1.pcap
transfer-2 ->slow-1.pcap
transfer-3 β fast-2.pcap
transfer-4 ->slow-2.pcap
closed
raguram
(Raguramakrishnan M)
September 29, 2026, 5:41am
10
@aggarg
code :
xResult = xTaskCreate( HttpServerTask,
"HttpServer",
HTTP_SERVER_STACK_SIZE,
NULL,
HTTP_SERVER_TASK_PRIORITY,
&xHttpServerTaskHandle );
static void HttpServerTask( void * pvParameters )
{
Socket_t xServerSocket = FREERTOS_INVALID_SOCKET; //FREERTOS_ECLOSED
struct freertos_sockaddr xBindAddress;
TickType_t xRecvTimeout = pdMS_TO_TICKS( HTTP_RECV_TIMEOUT_MS );
TickType_t xSendTimeout = pdMS_TO_TICKS( HTTP_SEND_TIMEOUT_MS );
Socket_t xClientSocket = FREERTOS_INVALID_SOCKET;
struct freertos_sockaddr xClientAddress;
socklen_t xClientAddressLength = sizeof( xClientAddress );
char character[1];
( void ) pvParameters;
xHttpServerTaskHandle = xTaskGetCurrentTaskHandle();
ulTaskNotifyTake(pdTRUE,portMAX_DELAY);
HttpLog( "HTTP server task starting" );
xServerSocket = FreeRTOS_socket( FREERTOS_AF_INET,
FREERTOS_SOCK_STREAM,
FREERTOS_IPPROTO_TCP );
if( xServerSocket == FREERTOS_INVALID_SOCKET )
{
HttpLog( "Socket create failed" );
vTaskDelete( NULL );
return;
}
xBindAddress.sin_port = FreeRTOS_htons( HTTP_SERVER_PORT );
if( FreeRTOS_bind( xServerSocket, &xBindAddress, sizeof( xBindAddress ) ) != 0 )
{
HttpLog( "Bind failed" );
FreeRTOS_closesocket( xServerSocket );
vTaskDelete( NULL );
return;
}
if( FreeRTOS_listen( xServerSocket, HTTP_BACKLOG ) != 0 )
{
HttpLog( "Listen failed" );
FreeRTOS_closesocket( xServerSocket );
vTaskDelete( NULL );
return;
}
HttpLog( "HTTP server listening on port 80" );
for( ;; )
{
xClientSocket = FreeRTOS_accept( xServerSocket, &xClientAddress, &xClientAddressLength );
if( xClientSocket == FREERTOS_INVALID_SOCKET )
{
/* Internal/transient issue: keep serving */
HttpLog( "Accept failed or timed out" );
vTaskDelay( pdMS_TO_TICKS( 50 ) );
continue;
}
else if(FreeRTOS_recv(xClientSocket, character, 1, 0) <= 0)
{
printf("No client Connection\n");
//FreeRTOS_closesocket(xClientSocket);
xClientSocket = FREERTOS_INVALID_SOCKET;
continue;
}
BaseType_t xNoDelay = pdTRUE;
FreeRTOS_setsockopt(xServerSocket, 0, 999, &xNoDelay, sizeof(xNoDelay));
HttpHandleClient( xClientSocket,character[0],1);
FreeRTOS_shutdown( xClientSocket, FREERTOS_SHUT_RDWR );
/* Wait for queued data and TCP shutdown to complete. */
while( FreeRTOS_recv( xClientSocket,
character,
sizeof( character ),
0 ) > 0 )
{
/* Discard any remaining client data. */
}
FreeRTOS_closesocket( xClientSocket );
}
vPortFree(led_Register);
}
aggarg
(Gaurav Aggarwal)
October 4, 2026, 4:47pm
11
I looked at the attached captures and the device appears to be slow in sending the data. Is it possible that the code which reads this data is taking different time in different runs. Can you try with a hardcoded buffer containing some random data to eliminate this possibility?