|
Scott, This did the trick! Is this list great or what! Thanks to Chris, too, for this thoughts. Patrick ----- Original Message ----- From: "Scott Klement" <klemscot@klements.com> To: <midrange-l@midrange.com> Sent: Monday, July 08, 2002 5:38 PM Subject: Re: TCP Keepalive not working? > > On Mon, 8 Jul 2002, Patrick Townsend wrote: > > > > Have any of you TCP gurus gotten the TCP KeepAlive function to work? > > > > I hadn't previously used this option with a server socket, but > I wrote a quickie test program, and fired up the ol' packet sniffer, and > it appears to work. > > Here are some important notes: > > From IBM's manual for setsockopt(): > > "For sockets that use a connection-oriented transport service, IP > options that are set using setsockopt() are only used if they are > set prior to a connect() being issued. After the connection is > established, any IP options that the user sets are ignored." > > As usual, IBM is vague. We're not calling connect(), but it should still > work as long as we set the socket option before the socket is connected to > the other end. Of course, that creates a new problem, because accept() > makes a new socket and immediately connects it :) Fortunately, in > the docs for accept() we see this: > > "The following are inherited by the descriptor returned by the > accept() call: > - All socket options with a level of SOL_SOCKET." > > So, what you actually want to do, is do the setsockopt() on your > "listener" socket (the one that you use as an argument to bind(), listen() > and accept()) then the client's socket will inherit it. > > That's what I did... and it worked for me. To be precise, I called > setsockopt() immediately after calling socket() for the listener socket. > > > But it never works. The TCP attributes have been changed for keepalive > > every 60 seconds. A sniffer trace shows that the AS/400 is not sending > > out any frames. > > Make sure that when you do a CHGTCPA TCPKEEPALV() that you understand that > the times are in MINUTES not seconds! :) I.e. for a 60-second, you'd > do CHGTCPA TCPKEEPALV(1). > > If you do TCPKEEPALV(60), it'll send them once per hour, which probably > isn't what you wanted ;) > > Good luck! > > > _______________________________________________ > This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list > To post a message email: MIDRANGE-L@midrange.com > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l > or email: MIDRANGE-L-request@midrange.com > Before posting, please take a moment to review the archives > at http://archive.midrange.com/midrange-l. > >
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.