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


  • Subject: RE: TCP/IP Sockets
  • From: Buck Calabro <mcalabro@xxxxxxxxxxxx>
  • Date: Fri, 4 Jun 1999 09:25:36 -0400

>First I want to thank everyone for their support.  I have my socket client
>working, with one minor glitch.  It will wait forever for a response from
>the socket server.  I want to timeout after xx seconds.  the send and
>receiver timer options are not supported.  Once I have connected to the
>server, how does one timeout if the server does not respond to a request.
>My program just sits at TIMW.  I am using an "AF_INET / SOCK_STREAM"
>connection.  I am the client.  If the server is hung, I want to close the
>connection and establish a new connection then resend the transaction.  I
do
>not now how to control this timeout value.  Any suggestions will be
>appreciated.

Chris,
While not an expert, I think you need to set the non-blocking flag.  There's
a section in the OS/400 Sockets Programming manual about Non-blocking I/O
that talks about this.  Here's some code that I've been tinkering.  I
haven't been able to verify if it's correct yet though... The "hot" project
I was working on got cold!

                                                      
 * Set the I/O Blocking                               
 *                                                    
D IOCtl           PR            10I 0 EXTPROC('ioctl')
D                               10I 0 VALUE           
D                               10U 0 VALUE           
D                                 *   VALUE           
                                                             
 *                                                           
 * Fields for the IO Blocking Options process                
 *                                                           
D FIONBIO         S             10U 0 INZ(131074)            
D SockIO_Off      S             10I 0 INZ(1)                 
D Sock_IOPOf      S               *   INZ(%ADDR(SockIO_Off)) 
                                                     
 * Set the non block attribute                       
C                   Eval      rc = IOCtl(sd: FIONBIO:
C                                        Sock_IOPOf) 
C                   If        rc < 0                 
C                   CallP     close(sd)              
C                   Dump                             
C                   Eval      *InLR=*On              
C                   Return                           
C                   EndIf                            

do the read() or write()

Buck Calabro
Billing Concepts Albany, NY
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This is the RPG/400 Discussion Mailing List!  To submit a new         *
* message, send your mail to "RPG400-L@midrange.com".  To unsubscribe   *
* from this list send email to MAJORDOMO@midrange.com and specify       *
* 'unsubscribe RPG400-L' in the body of your message.  Questions should *
* be directed to the list owner / operator: david@midrange.com          *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


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.