I am using the example to create a server.
Even if the xBacklog has value 20, it accepts only one connection.
Is there some other point to set the number of connection.
Thanks for helping.
Best regards
Thanks for reaching out.
Can you please share the link of the example you are using to create the server?
Hello Manvendra,
I am using the example in simulation, both on a real machine and in a virtual machine, both in a company network and a home network. Same problem.
Best
Hello, thanks for reply I cannot add the complete link. /FreeRTOS_Plus_TCP/TCP_Networking_Tutorial_TCP_Client_and_Server.html
The function is vCreateTCPServerSocket
It works perfectly, it acceps connection, I spawn a thread which communicate.
When I close connection from PC, the spawned thread closes connection.
After that It does not accept any connection and even if I ping it does not reply.
Before I close the connection of the client, it replies to ping.
Best Regards
Have you modified the code or are you using the same code present in the example?
Anyways, I have forwarded this ticket to the team working on the connectivity software and will get back to you soon!!
Thank you.
Best Regards
Can you break the code in the debugger and see what it is doing when the program appears to stop responding?
I did, it looks like it does not accept the connection and it does not reply to the ping.
More when the server starts, the sample code prints prvIPTask started, but i need to wait a bit before ping or it does not reply. I have seen on wireshark.
What do you see when you break in the debugger? What is the IP task doing? What is the task that you spawned for handling connecting doing?
That is likely because IP task takes some time for initial configuration and bring up the network.
Hi,
I try to explain my problem.
I start the server on freertos simulation.
It accepts the connection from a client. The client receive all data. They are ok. Then I close connection. The server closes the connection too. The thread that I spawned on the server finishes. The socket closed.
I again connect the client, the second times might work or not. If it works I receive the same packets I have previously received, if not good I found in the log tcp previous segment not captured two times. The data received by the client are not the ones he expected. The packed size are different from the previous ok transmission. Everything is in a mess.
I have logs but I cannot upload in this conversation.
I am not allowed
Best
Possible for you to share your complete code?
You should now be able to.
Yes sure.
The freertos server is
…gitlab.com/fortunato.marrelli/RtosWin32.git
The client is
…gitlab.com/fortunato.marrelli/RemoteDesktopWpf.git
Hope they compiles
Best
Hi @manvensh, you are sharing your Win32 server project, but I can not find a project files like e.g. xxx.sln, which is used by Visual Studio?
Can you please show your logging, you should be allowed to submit it now.
You wrote:
Even if the xBacklog has value 20, it accepts only one connection.
The system keeps track of the actual number of “children” of a TCP server socket. When xBacklog = 20
, it will refuse to accept the 21st connection, unless other connections were terminated.
Is there some other point to set the number of connection?
No, xBacklog
connections will be accepted, unless your application is running out of resources, think of heap and stack space, network buffers, etc.
The function vPrintResourceStats()
will print warnings when any of the resources runs out. Please define ipconfigCHECK_IP_QUEUE_SPACE
as 1
in your FreeRTOSIPConfig.h and make sure that vPrintResourceStats()
is called regularly from one of the FreeRTOS tasks (not from a Windows thread).
When a new connection is accepted, why do you call osThreadNew()
twice? A single task should be enough.
Hello Hein Tibosh.
I just cloned the server project and it has RemoteDesktop.sln.
Anyway here the log.
There are two ok acquisitions “Tutto Ok”
and two stuck acquisition.
I mean that the server got stucked.
It looks like when I have tcp previous packed not captured.
The server is blocking in reception and seems no data arrives.
Here to answer your question
Best Regards
(Attachment Stuck Stripe 3.pcapng is missing)
(Attachment Tutto Ok 1.pcapng is missing)
(Attachment Tutto Ok.pcapng is missing)
(Attachment Stuck Stripe 3.1.pcapng is missing)
It looks like I cannot attach wireshark log files.
Best
I preferred to split, one sender and one receiver. The receiver is blocking waiting for communication from the client. The sender, sends to client the display bitmaps, when it changes. The client capture the image and shows it.
I did one version, with one thread, the receiver was not in blocking. It has the same problems
Hi,
I defined the flag and put vPrintResourceStats in a thread. But I do not know where it prints.
Log Wireshark.zip (84.5 KB)
Hello Hein Tibosch.
These are the information I have
- The server not always is reachable when I ping it. But this could depends on router, firewall, wrong setup
- The server always accept connection and the receiver thread works always.
- The sender thread works for the first two times after the client closes connection then FreeRTOS_send fails returning a negative number.
- When the communicatio is ok it works for days without problems.
- When there is a fail in sending I see from log the message tcp previous segment not captured.
- It stucks always at the same position.
- In one wireshark forum someone wrote he found he had a wrong lwip setup but did not specify how he solved.
Could you please suggest me what i can inspect, see in setup.
Best Regards.
Sorry for my annoying message
Hello @Marbro1965,
There is something unusual in your IP-configuration, you are using the addresses:
192.168.0.1 192.168.0.5 // network 192.168.0
192.168.1.1 192.168.1.110 // network 192.168.1
192.168.2.31 192.168.2.62 // network 192.168.2
192.168.4.105 // network 192.168.4
192.168.10.45 192.168.10.91 // network 192.168.10
That is quite unusual, unless all devices use the same netmask 255.255.0.0. In your FreeRTOSConfig.h I find:
#define configNET_MASK0 255
#define configNET_MASK1 255
#define configNET_MASK2 255
#define configNET_MASK3 0
which makes a netmask of 255.255.255.0
I see many ARP messages, e.g. x.x.0.1 looking for x.x.2.3, but no answer is seen.
You will either have to change the netmasks in all devices to 255.255.0.0
, or change the IP addresses to get the same network address, e.g. let all start with “192.168.1”
The TCP conversion is between:
192.168.1.20 ( FreeRTOS )
192.168.10.120 ( laptop )
Your wireShark sees every packet twice. This should not be a problem, but it is disturbing.
What are the IPv4 address settings of your laptop?
I defined the flag and put vPrintResourceStats in a thread. But I do not know where it prints.
It will call FreeRTOS_printf()
to print the warnings. It seeems that it will go to the console of you laptop:
extern void vLoggingPrintf( const char * pcFormatString, ... );
#define ipconfigHAS_PRINTF 1
#if ( ipconfigHAS_PRINTF == 1 )
#define FreeRTOS_printf( X ) vLoggingPrintf X
#endif
Could you share the Visual Studio project files like *.sln
and *.vcxproj.*
? With those I can try out your project.
Thanks
Hi, thanks very much for reply.
Immediately I give you the link.
EDIT Link removed by @htibosch
I am reading the email accurately. There are things I do not understand unfortunately.
I only have filtered the log with the ip.source==192.168.1.20 which is the address assigned.
Best.