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



>From my blocking TCP/IP experience, you can't set a timeout on a read.

You may, however, be able to use select() to see if any data is waiting
before you try the read.

99% of my TCP/IP programming is in Pascal, C or C++, however, so I don't
know the RPG syntax of the Select() command.  select() is the C/C++ version.
Not sure how this translates to RPG.

Basically something like (in pseudo code):

if ( select(socket) )
        read ( data, socket );

in a cycle.  If you want to wait 10 seconds for data something like:

StartTime = Timer;
while ( Timer - StartTime < 10000 )
        if ( select(socket) )
        {
                read( data, socket );
                return data;
        }

ShowMessage( NULL, "No data to receive", "Error", MB_OK );

Some of the syntax of those C calls are way off and won't work in C, but it
should give you the idea.  I *believe* I'm using select with blocked sockets
in my c++ program (don't have code here to confirm, it's a home project).

HTH,

Jim Langston

-----Original Message-----
From: David Gibbs [mailto:dgibbs@mks.com]

Folks:

Does anyone know if it's possible to set a timeout on a TCP/IP connect?

My research indicates that there is no easy way to do this ... I found
http://www.developerweb.net/sock-faq/detail.php?id=36 which talks about
setting the socket into non-blocking mode, which I really don't want to do
at this point (it would change my applications structure more than I'm
willing to deal with now).

Thanks!

david


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.