× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



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!




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.