You don't change the SO_SNDTIMEO value. That is merely a flag, which you
pass to setsockopt with a specified value, to change the send timeout.
You may want to read the docs for setsockopt:
[1]
https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_72/apis/ssocko.htm
Also, Scott Klement's guide:
[2]
https://www.scottklement.com/rpg/socktut/setsockoptpapi.html
----- Original message -----
From: a4g atl <a4ginatl2@xxxxxxxxx>
Sent by: "MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxxxxxxxx>
To: Midrange Systems Technical Discussion
<midrange-l@xxxxxxxxxxxxxxxxxx>
Cc:
Subject: Re: Example socket program to send data to a non IBM i device
Date: Wed, Feb 20, 2019 1:14 PM
Has anyone been able to change the send timeout values? I tried changing
the SO_SNDTIMEO constant value from 70 to 10, but this has not made a
difference.
I need to get the timeout changed to 3 to 5 seconds.
Darryl Freinkel.
On Wed, Feb 20, 2019 at 9:27 AM a4g atl <a4ginatl2@xxxxxxxxx> wrote:
> Scott is correct. We have equipment that may not be online all the
time
> and in this instance, the program is waiting for the response.
>
> At this point the "default" timeout is somewhere in the regions of 3
to 5
> minutes before dropping back to my code. I am working to reduce this
to 3
> seconds, today.
>
> This is a major issue here as we have between 5 and 100 devices and
for
> those not responding, it delays the entire process as its a single
threaded
> process. 20 devices being offline results in a delay of 60 minutes.
>
> TIA
>
> Darryl
>
>
> On Tue, Feb 19, 2019 at 1:26 PM Scott Klement
<midrange-l@xxxxxxxxxxxxxxxx>
> wrote:
>
>> Alan,
>>
>> I'd like to reply to some of the things in your message, I'll put my
>> comments inline.
>>
>>
>> > The hanging thing is a new one. Are other people using this socket
>> server?
>> > It doesn't sound like the socket server is not responding, it
sounds
>> like
>> > you are connecting and then being hung up.
>>
>> "Socket" is a set of routines that can be used for many different
>> things... I assume this example is TCP?
>>
>> It is an extremely frequent issue with TCP that they "hang" when a
>> firewall is blocking the connection, or when the network connection
gets
>> broken, etc. TCP is meant to be completely reliable, so the
receiving
>> side will send acknowledgements of the data received, and the sender
>> will re-send anything that wasn't acknowledged, basically it'll get
>> stuck re-sending indefinitely if it gets no response.
>>
>> For that reason, you should always implement a time out mechanism in
a
>> TCP application.
>>
>> > Normally socket attempts to make a connection. That connection is
either
>> > accepted or rejected. If there is nothing to connect to it just
returns
>> an
>> > error.
>>
>> ...but that error can only be received if the network connection is
open
>> and working. If something is blocking it (a firewall, or something
like
>> an unplugged cable, power turned off, etc... anything that would
prevent
>> the error message being sent back) instead of an error, you'll sit
and
>> wait indefinitely.
>>
>>
>> If by "socket server" (hate that term) you don't mean a TCP server
but
>> you mean something else, then my comments above may not apply. It'd
help
>> me out a lot if you'd be more specific rather than using terms like
>> "socket server" or "socket client". Say TCP if you mean TCP. If you
>> can be even more specific (like Telnet, FTP, HTTP, SMTP, PPTP, etc)
then
>> please do.
>> --
>> This is the Midrange Systems Technical Discussion (MIDRANGE-L)
mailing
>> list
>> To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
>> To subscribe, unsubscribe, or change list options,
>> visit: [3]
https://lists.midrange.com/mailman/listinfo/midrange-l
>> or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
>> Before posting, please take a moment to review the archives
>> at [4]
https://archive.midrange.com/midrange-l.
>>
>> Please contact support@xxxxxxxxxxxx for any subscription related
>> questions.
>>
>> Help support midrange.com by shopping at amazon.com with our
affiliate
>> link: [5]
https://amazon.midrange.com
>>
>
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: [6]
https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at [7]
https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxx for any subscription related
questions.
Help support midrange.com by shopping at amazon.com with our affiliate
link: [8]
https://amazon.midrange.com
References
Visible links
1.
https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_72/apis/ssocko.htm
2.
https://www.scottklement.com/rpg/socktut/setsockoptpapi.html
3.
https://lists.midrange.com/mailman/listinfo/midrange-l
4.
https://archive.midrange.com/midrange-l
5.
https://amazon.midrange.com/
6.
https://lists.midrange.com/mailman/listinfo/midrange-l
7.
https://archive.midrange.com/midrange-l
8.
https://amazon.midrange.com/
As an Amazon Associate we earn from qualifying purchases.