MQX 4.1 RTCS PPP interface unbinding with FTP Client

cancel
Showing results for 
Search instead for 
Did you mean: 

MQX 4.1 RTCS PPP interface unbinding with FTP Client

573 Views
francescocontin
Contributor II

In MQX 4.1 i'm running a PPP client application:

1) Open PPP

2) Open FTP Client

3) send STOR data....

4) Call PPP_release (or PPP linkdown) during data transmission

5) the PPP interface goes down (RTCS_if_unbind)

6) in RTCS Socket Summary: FTP client socket are still connected with the "unbinded" address (blocked in recv or send)

7) Restart PPP:a new interface address is assigned

8) FTP Client is still blocked with sockets in the old "unbinded" address... it seems an "half-open-like" deadlock

Questions:

A) how long the FTP Client sockets remains connected? forever?

B) how could I "shutdown" those sockets?

C) RTCS_if_unbind doesn't "shutdown" all interface sockets?

D) there is a "select_all by interface sockets and shutdown" RTCS function?

E) in a double interface application, when the ENET interface is active too, and socket sin_addr is ADDR_ANY, the only solution is to maintain a list of created socket and update interface bind (getsockname)?

F) at step 4 is generated a "MSGQ: queue is not open" task error: why? it's a problem?

Regards

Francesco

Labels (1)
Tags (5)
0 Kudos
3 Replies

70 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Francesco,

I am not sure if I am getting the setup.

- Are you using FTP through PPP using NAT? Or FTP is connected through Ethernet and PPP has another purpose?

- What do you have in the other side of the PPP connection and what do you have in the other side of Ethernet link?

Carlos

0 Kudos

70 Views
francescocontin
Contributor II

Hi Carlos

it's a K64 RTU with two interfaces: the ENET (phy) and PPP (through serial tty connected to a SIM900 GSM/GPRS Modem with a data SIM etc...).

The RTCS stack works well: using MQX FTP client the RTU upload/downloads files to a FTP server in the internet (static address).

When the PPP is linked, client  uses GPRS, otherwise client uses ethernet.

The problem is when I have to disconnect the Modem (daily) and stop/restart PPP (intentionally disconnection), or when the PPP/GPRS connection links down (unintentionally disconnection) during PPP operations.

The PPP interface is "unbind" and restarts correctly with a different local/remote IP Address (depends by operator "natting" policy).

BUT sockets created and connected running with the old PPP interface (old local address) still remains active in a unpredictable state (could be sendind/receiving) forever (or could be hours), MORE than the default timeout times (i think about 8' or 4', see FTP client socket configuration).

Note: for memory reasons  i have to wait for sockets close, timeout or shutdown before opening new connections.

My questions are about socket philosophy and implementation:

1) Why when I "shutdown" an interface, connected sockets still remains "active"? I have to shutdown them manually? or is a TIMEOUT configuration problem?

2) sockets are created in MQX RTCS Application by the FTP client task (and functions): for an "outside" control there is a "select by interface and shutdown" comand, or a way to implement a similar command (if is appropriate or useful), something like the RTCS_selectall.

3) the only solution is to collect and maintain a list of running sockets on the different interfaces and then shutdown them when PPP links down?

Best Regards

Francesco

0 Kudos

70 Views
Carlos_Musich
NXP Employee
NXP Employee

Hi Francesco,

for instance I strongly recommend to use MQX4.2 and apply MQX4.2.0.1 and MQX4.2.0.2 patches.

As you say you must close sockets gracefully. If link is down unexpectedly the sockets will not be released. Please see chapter 3.29 Shutting down stream sockets of RTCS reference manual.

C:\Freescale\Freescale_MQX_4_2\doc\rtcs\MQX_RTCS_User_Guide.pdf

On the other hand, you can handle TIMEOUTS using setsockopt().


Best regards,
Carlos

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos