Announcement

Collapse
No announcement yet.

Problems trying to reconnect a TCP socket when both AP and LAN enable

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problems trying to reconnect a TCP socket when both AP and LAN enable

    Hi,

    I'm trying to have a socket which would automatically reconnect to a server after the socket closed.

    My desired configuration is AP0 bridged to ETH0.

    With this configuration, the socket connect at startup if the ltrx_tcp_connect() is call within 10 sec of startup. If I increase this delay with a sleep it fail to connect. It might correspond to the time taken by the AP to be up and running.
    If I restart the server, the connection is lost and the socket fail to reconnect with every attempt.

    The result is the same without the bridging, so I'm assuming it's not the problem.

    When I disable the AP, All the problem vanish.
    ltrx_tcp_connect() work no matter when it is called.

    I've also noticed that when I'm trying to reconnect with the AP enabled, reconnection attempt take at least 8sec, but when AP is disabled, it take under 1 sec.

    I'm wondering if there is a way to select the desired interface used to open the socket.

    Would any of you have an idea to where is the problem?

    Thanks,

    vchartier

    EDIT: I'm using SDK 2.0.0.4R14.

  • #2
    Trying to clarify to replicate the issue. The server that you are trying to connect to, is it connected to the SoftAP of the xPico 200, or is it on the Ethernet side?

    Comment


    • #3
      The server is connected with the wired(ethernet) connection. It's a custom server running on a dedicated port. It's always accepting new connection. The server can be substituted with netcat for testing purpose.

      The program I've writen to find the problem is really just trying to open a TCP connection with the server.It open it, close it, wait 15sec, then reopen it. No data is transferred during those tests.
      Other then that, I've a safety function that verify if a pin is shorted to ground using cpm before letting the module do anything else.

      From my observation, when the SoftAP is enabled, the xPico 200 will be able to establish a connection only before the SoftAP is initialized. After this, all connection attempt will fail.

      If you want, I can send you the source code of this program.
      Last edited by vchartier; 02-07-2019, 09:02 PM.

      Comment


      • #4
        Sounds good. I will send you an email so that you can send me your code.

        Comment


        • #5
          To anyone who might be interested in the solution, it was a problem with the interface priority in the configuration. I needed to set the ethernet interface to priority 1 and the others to a lower priority.

          Comment

          Working...
          X