|
Buck: I played around with this briefly also... and I found that, when I set non-blocking IO, and did a read... the read would not wait for data to be received. With blocking IO, read waits until it gets some data. david > -----Original Message----- > From: Buck Calabro [mailto:mcalabro@commsoft.net] > Sent: Friday, June 04, 1999 8:26 AM > To: 'RPG400-L@midrange.com' > Subject: RE: TCP/IP Sockets > > > >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 * > * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * > * * * * * * > * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 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 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.