× 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: "Scott Klement" <infosys@xxxxxxxxxxxx>
  • Date: 04 Jun 1999 12:05:43 -0500

Yes, thats what "blocking" and "non-blocking" mean.   When you're in
"blocking" mode your program "blocks" (waits) til each operation
is complete.

In "non-blocking" it doesn't "block" (wait), instead, it returns
immediately and the operation executes in the background.

I've used non-blocking sockets in windows programs, but I haven't
found a good way to use them in RPG, yet :)  Its much easier, IMHO,
to use select()!

Scott Klement
Information Systems Manager
Klement's Sausage Co, Inc.


David Gibbs <David.Gibbs@IL.US.MKS.com> wrote:
>
> Buck:
>
> I played around with this briefly also... and I found that, when I s
> non-blocking IO, and did a read... the read would not wait for data
>  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
> > >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.