Pat,

< A long sleep has the disadvantage to delay overall IPL time or at least the SBS start

DLYJOB DLY(30)

This only a 30 second delay, not even noticed on an IPL.

Actually, I have several, various delays at different spots where needed.
Some processes start immediately, others could take a bit, and those may needed and up completely before starting additional processes.

None as bad the ADMIN2 job, which is about 3 minutes till fully operational.

Paul



-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Patrik Schindler
Sent: Monday, January 3, 2022 7:00 PM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: Custom Subsystems / TCPIP-Start

________________________________
CAUTION: This email originated from outside of the PENCOR network. Do not click on any links or open attachments unless the sender is known, and the content is verified as safe.
________________________________

Hello,

Am 02.01.2022 um 18:59 schrieb Patrik Schindler <poc@xxxxxxxxxx>:

Aside from creating a loop in my applications to simply try again to allocate a socket and sleep some seconds after failure, instead of just exiting — which other options can you recommend?

Thanks for all who responded with ideas.

I'll take the route described above. It seems to be the most clean one to me. A long sleep has the disadvantage to delay overall IPL time or at least the SBS start. Pinging localhost would be another approach, but just trying socket() with a 1 second sleep in between is done easier than an external ping, code-wise.

Code-Snippets for the interested:


Before:
if ( (sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0 ) {
Qp0zLprintf("socket(): %s", strerror(errno));
exit(1);
}


After:
/* Keep trying to socket for 15 mins, so TCP/IP has enough time to start. */ for ( i = 0; i++; i <= 900 ) {
if ( (sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0 ) {
sleep(1);
} else {
Qp0zLprintf("socket() succeeded after %d tries.\n", i);
break;
}
}
if ( i >= 900 ) {
Qp0zLprintf("Tried socket() %d times, giving up. Last error was %s.\n",
i, strerror(errno));
exit(1);
}

:wq! PoC

--
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: 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 https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com

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.