×
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 24/10/2008, at 2:06 AM, Craig Jacobsen wrote:
When it drops, the connect() hangs for 3 to 5 minutes trying to make a
connection. (I would like that to be a second or 2, but there are no
timeout values). This hangs the 5250 manifest station for that
time before
I can issue an error message.
Is there a way I can test the IP address to make sure the device is
connected (other than PING) before I try the socket connection?
Consider that PING just says a system is available. Unless you ping a
specific port (not supported by all ping implementations) then all
you know is that a system is available. You do not know whether a
server is waiting on the port to accept your connexion attempt. Any
tool that can test a port for a waiting server is going to issue a
connect() anyway so seems a bit pointless.
You can shorten the time for connect() by:
1) using non-blocking sockets and select(). Put the socket in non-
blocking mode. Issue the connect(). It will return with EINPROGRESS.
Use select() to get notified when the socket is ready. select()
supports a time-out value so you can set how long you are prepared to
wait for the connexion to complete.
2) indicating that you want to catch SIGALRM, set an alarm() prior
to issuing the connect(), disable the alarm after a successful connect
(), and code a signal handler to catch SIGALRM. If the alarm is
raised then the connect hasn't completed in the time you allowed so
close and end.
Regards,
Simon Coulter.
--------------------------------------------------------------------
FlyByNight Software OS/400, i5/OS Technical Specialists
http://www.flybynight.com.au/
Phone: +61 2 6657 8251 Mobile: +61 0411 091 400 /"\
Fax: +61 2 6657 8251 \ /
X
ASCII Ribbon campaign against HTML E-Mail / \
--------------------------------------------------------------------
As an Amazon Associate we earn from qualifying purchases.