Ultimately I’m trying to set up two IP addresses on one interface on the Zynq (Zedboard) so that I can have two TCP servers:
TCP Server 1: 10.100.100.162, Port 5001
TCP Server 2: 10.111.111.163, Port 5001
Issue #1:
Even though TCP Server 1 and TCP Server have different IP addresses,
if I use the same Port number I get an configASSERT when creating the second socket which ends my application.
As a workaround I had to use a different IP port number for the second TCP Server
So I set:
TCP Server 1: 10.100.100.162, Port 5001
TCP Server 2: 10.111.111.163, Port 5002
And then the assert did not trigger.
Although workaround fixes my issue, I wonder why this issue exists.
Issue #2:
I have a Raspberry Pi (aka Rpi_151) connected to the Zynq through an Ethernet Switch.
This Rpi also has a dual IP address (10.100.100.151 and 10.111.111.151).
Observation 2A:
I opened up two terminal windows on Rpi_151.
In one terminal window Rpi_151 pings the Zynq on the 10.100.100.1 network (i.e. ping 10.100.100.162)
On the other terminal Rpi_151 pings the Zynq on the 10.111.111.1 network (i.e. ping 10.111.111.163)
Here’s the weird part: When I ping the 10.111.111.163 in terminal 2, then in terminal 1 window the replies to the 10.100.100.162 are paused or stop. Many packets are reported missing.
If I reverse the order of how I add the endpoints on the Zynq then the reverse is true.
(Pinging 10.100.100.162 stops/ pauses the pings/replies from 10.111.111.163).
Observation 2B:
I decided to get a second Raspberry Pi (Rpi_152) which also has dual IP addresses
(10.100.100.152 and 10.111.111.152).
If I use Rpi_151 to ping Zynq at 10.100.100.162
and use Rpi_152 to ping Zynq at 10.111.111.163,
then the Zynq is able to reply to both ping requests no problem.
It’s only when I’m using only ONE Rpi to ping the Zynq on both IP addresses that it seems like something goes wrong with the Zynq.
It’s like the FreeRTOS+TCP gets confused that my Rpi has two IP addresses.
Issue #3
So in order to test my two TCP servers running on the Zynq I have to use two Rpi’s.
One Rpi communicating on the 10.100.100.1 network
and the other communicating on the 10.111.111.1 network.
That’s the workaround for now at least.
Anyway, I’ll have both TCP Servers running on the Zynq.
The third issue I’m seeing is that one of the TCP servers (sometimes TCP Server 1, sometimes TCP Server 2)
will randomly end the connection if I have both TCP servers running simultaneously.
It appears that the “weaker” endpoint is the one I add first (this is the one associated with TCP Server 1). Even just having TCP Server 2 on standby (waiting for clients), and having the TCP Server 1 actively communicating with a client will result in connection dropped after a short period of time (5 min).
In the reverse scenario: TCP server2 actively communicating with a client, and TCP Server 1 waiting, then it seems like TCP server 2 doesn’t drop his client.
I’d have to run this test overnight to see if the second endpoint really is stronger, or if I just got lucky.
Whenever, the TCP Server drops the client I see this on the Zynq Console:
vTCPStateChange: Closing (Queued 0, Accept 0 Reuse 0)
vTCPStateChange: me 0x40cc68 parent 0x40cc68 peer 0x0 clear 0
vTCPStateChange: xHasCleared = 0
Also, when the connection gets dropped, I will go to the client terminal on Rpi and try to ping the Zynq and notice that I can’t ping the Zynq on that ipaddress for a period of time, and then I can ping again normally and reconnect my TCP client after some period of time (10 sec approx).
The source code for the TCP server included in my main.c was mostly taken from the tutorials here:
I wonder if one or more of my issues is related to the following forum post here:
I am attaching my main.c file.
I am also attaching my FreeRTOSIPConfig.h file
main_sdog.c (9.8 KB)
freeRTOSIPConfig_sdog.h (17.9 KB)