× 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.



Hmmm... i don't have an example handy, but... I would recommend two calls to setsockopt(). The one Kevin shows is one of them, but then also one to set TCP_KEEPALIVE which lets you set the keepalive interval.

Like I said before, I think relying on the CHGTCPA option is not a good idea, some day someone will change that setting for something unrelated and screw you up.

The stuff in CHGTCPA should only be used as "defaults". When an application has a speciic need for something (like your need for keep alives) it should be coded into that application explicitly.

So, two calls to setsockopt(). One wit SOL_SOCKET and SO_KEEPALIVE and one with IPPROTO_TCP and TCP_KEEPALIVE. This second option should tell it how often to send the keepalives.

-SK

On 9/2/2015 1:49 PM, Kevin Bucknum wrote:
From an old server program, the only one we ever turned keepalive on
for.

Eval Rc = setsockopt(sd: sol_socket
: so_keepal
: %addr(optval)
: %size(optval))

sd is the socket descriptor we got from the call to socket.
The program I cut the above code from is really old. Here is the current
definition in my copybook.
D* keep connections alive
D SO_KEEPALIVE C 25
D* socket layer
D SOL_SOCKET C CONST(-1)

d optval s 10u 0 inz(1)

CHGTCPA has the setting to control the interval.
Change TCP/IP Attributes (CHGTCPA)

Type choices, press Enter.

TCP keep alive . . . . . . . . . 5 1-40320, *SAME, *DFT

The help for that option.
TCP keep alive (TCPKEEPALV) - Help

Specifies the amount of time, in minutes, that TCP waits
before sending out a probe to the other side of a
connection. The probe is sent when the connection is
otherwise idle, even when there is no data to be sent.

The transmission of keep-alive packets is controlled by
individual sockets applications through use of the
SO_KEEPALIVE socket option. For more information see the
Socket programming topic collection in the IBM i
Information Center at
http://www.ibm.com/systems/i/infocenter/.




Kevin Bucknum
Senior Programmer Analyst
MEDDATA/MEDTRON
Tel: 985-893-2550

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jeff
Young
Sent: Wednesday, September 02, 2015 1:20 PM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Socket Keepalive

In a previous post, it was recommended that I use the SO_KEEPALIVE in
the setsockopt to enable my program to use this.
I have not been able to find any good example on how to set this and how
to configure the keepalive interval.
Does anyone have an example of this that I can refer to?


Jeff Young
Sr. Programmer Analyst
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.