[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: FTPAPI connection reset



Hi Charles,

Yes, that's correct, you have to change the code in FTPAPI in order to 
enable keepalives.  The stuff in CHGTCPA are really just defaults, 
nearly everything there can be overridden by the application.

Like I said in my earlier message, it'd be easy enough to do.

Sorry for being unclear, before.

In FTPAPI 2.3, you need to open up the FTPAPIR4 member and look for the 
TCP_CONN subprocedure.  Somewhere after the fcntl call and before the 
connect call, add code like this:

D wwKeepAlv       s             10i 0
    .
    .
c                   eval      wwKeepAlv = 1
C                   callp     setsockopt( wwSocket
c                                       : SOL_SOCKET
c                                       : SO_KEEPALIVE
c                                       : %addr(wwKeepAlv)
c                                       : %size(wwKeepAlv) )

If you are running the version with Dennis' upgrades (which I think I 
have in BETA right now?  I can't remember...)  then, the code is in the 
FTPAPIINT source member, and is free format, but otherwise should be the 
same.

I have not tested the above code, it's just off the top of my head... 
but, it's such a simple change, I can't see what could possibly go wrong 
(famous last words, I know). This is why I said you could easily add 
that in... because it's just so simple.

Anyway, sorry for the earlier confusion. Let us know how it goes.

-SK



On 3/15/2012 3:20 PM, Charles Wilt wrote:
> Scott,
>
> Getting back to this...
>
> We looked at the iSeries side, CHGTCPA, the TCPKEEPALV parm was set to
> 6 minutes, we tried changing it to 2 without effect.
>
>> From what I read here:
> http://tldp.org/HOWTO/html_single/TCP-Keepalive-HOWTO/#overview
>
> It appears that the socket itself must be enable to use keep alive:
> "All you need to enable keepalive for a specific socket is to set the
> specific socket option on the socket itself. The prototype of the
> function is as follows:
>
>    int setsockopt(int s, int level, int optname,
>                   const void *optval, socklen_t optlen)
>
>
> The first parameter is the socket, previously created with the
> socket(2); the second one must be SOL_SOCKET, and the third must be
> SO_KEEPALIVE . The fourth parameter must be a boolean integer value,
> indicating that we want to enable the option, while the last is the
> size of the value passed before. "
>
> I see where you've prototype the setsockopt() along with the
> SOL_SOCKET and SO_KEEPALIVE constants in SOCKET_H...but it doesn't
> appear that you're calling it in the TCP_Conn() parameter.
>
> Correct me if I'm wrong, but I understand the default for sockets to
> _NOT_ use keepalive, so what I'd what to do is add some code to
> TCP_Conn() to call setsockopt().  Might it also be a good idea to add
> an FTP_EnableKeepalive(), setting a module variable that can be
> checked in TCP_Conn,  to minimize effects to existing users?
>
> Thanks!
> Charles
>
>
>
> On Fri, Mar 2, 2012 at 3:12 AM, Scott Klement<sk@xxxxxxxxxxxxxxxx>  wrote:
>>
>> But, all of your links discuss setting up keepalives on the command
>> channel, and NOT trying to use NOOP during a transfer.  I know that the
>> dial-up modem situation I described earlier would ignore keep-alive
>> packets (and so they would *not* keep the dial-up active.)  But perhaps
>> they'll work in the NAT situation.
>>
>> It'd be easy enough to try turning on keepalives to see if it would
>> solve your problem, right?
> -----------------------------------------------------------------------
> This is the FTPAPI mailing list.  To unsubscribe, please go to:
> http://www.scottklement.com/mailman/listinfo/ftpapi
> -----------------------------------------------------------------------
>

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------