×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Yes, the HTTP server also uses signals, so your program is conflicting with the way signals are handled in the HTTP server.

Consider using non-blocking sockets for timeouts rather than signals.


On 10/16/2014 9:16 AM, j.beckeringh@xxxxxxxxxxxxxxxxxxxxxxxxxx wrote:
Based on the highly recommended examples from Scott Klement I created
programs (yes David, RPGLE programs :-) that communicate with scales
through sockets. I use sigaction and alarm to handle timeouts. Basic flow
of events:

- Register signal handler; save original signal handler (sigaction)
- Create socket
- Set alarm to 10 seconds
- Connect to socket
- If connected reset alarm, send command, receive data
- Close socket
- Restore original signal handler

This works great from a 5250 program. By defining the alarm time as an
entry field I can vary the time to timeout (very useful when debugging);
if I try connect to a non-existing IP address I get a timeout in the
specified time.

But if I try the same from a program that runs in the HTTP server (with a
call stack that includes Net.Data - DB2WWW) the signal handler never gets
called.

In debug I can see (trying to connect to a non-existing IP-address):
- sigaction returns 0, indicating that registering the signal handler was
successful; the data structure for the original signal handler contains
data
- alarm(10) return 0, indicating that no alarm was active; if I call alarm
twice, the second call returns something between 0 and 10, indicating that
the previous call was succcesful
- connect waits for 3 minutes and 6 seconds before returning 3447 - A
remote host did not respond within the timeout
- the signal handler never gets called

Anybody any idea what might be the problem? Could it be a conflict with
the HTTP server?

Release 7.1, TR7.

Joep Beckeringh



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