@tony-josi-aws
I first removed the printf statements to see if that would make a difference.
I did so by making vLoggingPrintf do nothing:
void vLoggingPrintf2( const char * pcFormat, ... )
{
return;
}
Unfortunately that did not help the situation.
I then made the gateway address the same for both endpoints:
static const uint8_t ucGatewayAddress1[ 4 ] = { 10, 100, 100, 1 };
static const uint8_t ucGatewayAddress2[ 4 ] = { 10, 100, 100, 1 };
And that did not help the situation either. One of the TCP servers dropped out.
The second TCP server is still going. I’ll let it run overnight to see if it eventually drops out also, or if just having one server running is ok.
One more thing, I’m wondering if one of my other function stubs in main.c be an issue?
EDIT #1:
I was doing some experimenting and discovered something kind of interesting.
What I’m trying to do is use prvConnectionListeningTask() to create two TCP servers:
TCP Server1: 10.100.100.162 port 5002
TCP Server2: 10.111.111.163 port 5003
I have two linux machines in my lab. Let’s say I use a dual IP address on Linux Machine 1 and create the two TCP servers on the TCP server addresses and ports above.
If on Linux machine #2 I have a TCP client on 10.100.100.151, it can only connect to 10.100.100.162:5002. If I try connecting using port 5003 (i.e. connecting to 10.100.100.162:5003), then I get a connection error.
However, it is different behavior when using FreeRTOS+TCP.
If the Zynq has both TCP servers created above (10.100.100.162:5002 and 10.111.111.163:5003), I can use a Linux machine as a TCP client to connect to 10.100.100.162 on port 5003 or port 5002. No connection error here!
This is not what I was expecting. Why did it not give me a connection error?
Could this give us some insight as to why one of the TCP servers goes out?
Edit #2
I decided to do some more experimentation.
I modified my application to only have one endpoint.
I then created two TCP server threads:
TCP Server 1: 10.100.100.162 Port 5002
TCP Server 2: 10.100.100.162 Port 5003
I did similar experiment as before: two clients connecting to those two TCP servers
Rpi151 (10.100.100.151) as TCP Client 1 connecting to 10.100.100.162 Port 5002
Rpi152 (10.100.100.152) as TCP Client 2 connecting to 10.100.100.162 Port 5003
So far both TCP Server threads have been running without any issues.
(80 min so far and counting with no issues).
So there is something different about having that second endpoint.
Edit #3
One more experiment. I went back to creating two endpoints. However, this time I only create two TCP servers on the first endpoint (10.100.100.162).
Been running the TCP servers and clients for 40min so far and things appear to be stable.
Edit #3a
This is an update to the experiment in edit #3.
I let the TCP servers run overnight.
After 4829 sec (approx 1hr 20min), one of the TCP servers disconnected its TCP client.
The other TCP server and client are still up and running 42348 sec and counting (approx 11.5hrs and counting).
Note that this is with making the vLoggingPrintf do nothing (just return).
Edit #3b
Ran experiment from edit #3 yet again.
One TCP Server disconnected it’s client after 750 sec (approx 12 min).
The second TCP Server still running.
Edit #3c
Again I’m been experimenting around. I found another interesting find.
So after creating the two endpoints I only created the two TCP servers on endpoint 1, or so I thought.
TCP Server 1: 10.100.100.162 Port 5002
TCP Server 2: 10.100.100.162 Port 5003
However, on the Raspberry Pi I was able to create a TCP client that could connect to:
TCP Server 1: 10.111.111.163 Port 5002
TCP Server 2: 10.111.111.163 Port 5003
Very odd that the TCP server binding is so loose, if that makes sense.
Is there something wrong with FreeRTOS_bind() when there are multiple endpoints?