Limit the count of connections to 1 by using the reuse socke option: LINK
Reuse socket (
FREERTOS_SO_REUSE_LISTEN_SOCKET
): A TCP server socket can turn itself into a connected socket. That option is only applicable to TCP, not to ARP or UDP.
- Is it normal that processing for +TCP to process that much ARP packages?
It might happen on a large network. I’m surprised that you don’t also see lots of UDP broadcasting.
Did you find out who is sending all those ARP packages? What kind of ARP packages are they?
- Is it normal that ARP-connections are processed in parallel?
ARP is connectionless. In most cases, you will see:
Q: Who has IP-address 192.168.x.x ?
A: I am 192.168.x.x ? with MAC address y-y-y-y-y-y
Beside that, there is the gratuitous ( unsolicited ) ARP message: it only expects an answer from a peer who happens to have the same IP-address.
I attach a short PCAP showing the 3 ARP packets: ~
arp_requests.pcapng
”
- Is there any other option of optimizing the RAM usage caused
by the address resolution protocol (ARP) ?
It is a nasty problem. It may force the Network Interface to drop important TCP/UDP packets because all buffers are occupied with ARP packets.
It might be useful to do some quick pre-filtering here.
Receiving lot of ARP packets may also spoil your ARP table. Suppose you look-up a peer, then after a few seconds, the ARP entry will be re-written by another unsolicited ARP reply.
I once had an embedded device in a large LAN. It could hardly function normally because of the frequent UDP broadcasting. We solved it by early filtering. The earlier the better.
On remark about TCP and buffer space: have a look at the socket option
FREERTOS_SO_WIN_PROPERTIES
. It lets you determine the TCP window size and the buffer sizes in both directions.
Apply the socket options to the (listening) parent socket: it will be inherited by the connected (child-) socket.
If TCP speed is not important, you may consider to define:
~~~
define ipconfigUSETCPWIN 0
~~~
The length of the TCP window will be equal to MSS. This saves a lot of RAM and code.