No timeout on RTCS FTP server ?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

No timeout on RTCS FTP server ?

ソリューションへジャンプ
1,026件の閲覧回数
lucky06200
Contributor II

Hello,

I use ftpd server with only one session on ARM M4 (K60) + MQX 4.0.0 + RTCS 3.08

When active connection exist, and there is no more trafic, server do not close the connection (no timeout).

So, server is locked for other client.

How can i have a connection close when no traffic occurs during a given time ?

Is this possible to change socket option, for example (in ftpd.c code if needed) ?

If yes, wich option is OK for this ?

Or may be i need to write code in my application for this ?

Best regards,

Luc

ラベル(1)
0 件の賞賛
返信
1 解決策
701件の閲覧回数
lucky06200
Contributor II

I found a solution to my problem.I add a socket option (FTPDCFG_RECEIVE_TIMEOUT) in FTPd_task.

Something like :

(around line 150)

  if (!error) {
      option = FTPDCFG_CONNECT_TIMEOUT; 
      error = setsockopt(listensock, SOL_TCP, OPT_CONNECT_TIMEOUT, &option, sizeof(option));
  }

  if (!error) {
      option = FTPDCFG_TIMEWAIT_TIMEOUT; 
      error = setsockopt(listensock, SOL_TCP, OPT_TIMEWAIT_TIMEOUT, &option, sizeof(option));
  }

  if (!error) {
      option = FTPDCFG_RECEIVE_TIMEOUT;  // Set this value to what you need (360000 for 6 minute, for me)
      error = setsockopt(listensock, SOL_TCP, OPT_RECEIVE_TIMEOUT, &option, sizeof(option));
  }

  if (!error) {
      error = bind(listensock, (const sockaddr *)&laddr, sizeof(laddr));
  }

  if (!error) {
      error = listen(listensock, 0);
  }

  if (error) {
      RTCS_task_exit(creator, error);
  }
  RTCS_task_resume_creator(creator, RTCS_OK);


So, ftpd exit after no trafic during 6 min.


:smileyhappy:


元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
701件の閲覧回数
soledad
NXP Employee
NXP Employee

Hi Luc,

Thank you for share your solution :smileywink:

Regards

Sol

0 件の賞賛
返信
702件の閲覧回数
lucky06200
Contributor II

I found a solution to my problem.I add a socket option (FTPDCFG_RECEIVE_TIMEOUT) in FTPd_task.

Something like :

(around line 150)

  if (!error) {
      option = FTPDCFG_CONNECT_TIMEOUT; 
      error = setsockopt(listensock, SOL_TCP, OPT_CONNECT_TIMEOUT, &option, sizeof(option));
  }

  if (!error) {
      option = FTPDCFG_TIMEWAIT_TIMEOUT; 
      error = setsockopt(listensock, SOL_TCP, OPT_TIMEWAIT_TIMEOUT, &option, sizeof(option));
  }

  if (!error) {
      option = FTPDCFG_RECEIVE_TIMEOUT;  // Set this value to what you need (360000 for 6 minute, for me)
      error = setsockopt(listensock, SOL_TCP, OPT_RECEIVE_TIMEOUT, &option, sizeof(option));
  }

  if (!error) {
      error = bind(listensock, (const sockaddr *)&laddr, sizeof(laddr));
  }

  if (!error) {
      error = listen(listensock, 0);
  }

  if (error) {
      RTCS_task_exit(creator, error);
  }
  RTCS_task_resume_creator(creator, RTCS_OK);


So, ftpd exit after no trafic during 6 min.


:smileyhappy:


0 件の賞賛
返信