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



Some answers from my Sockets programming in general, not AS/400 specific
since I've only done one AS/400 socket program so far.  Comments in line.

-----Original Message-----
From: Gene_Gaunt@ReviewWorks.com [mailto:Gene_Gaunt@ReviewWorks.com]

> Question 1:
>
> The API reference for the socket select() wait time parameter says,
>
> "A time to wait of 0 is allowed; this returns immediately with the current
> status of the sockets."
>
> What is this "current status" that gets returned?

I use select() in this fashion to see if any socket has any data waiting to
receive in my server program.  Every cycle I will cycle through my array of
sockets and call select() with a wait time of 0  to see what needs to be
done.  The usual answer is data waiting to be received.  I believe that
other events are socket closed, and on my listening socket, the event is
connection request.

> Question 2:
>
> Will a non-zero select() wait time value slow down an application, if our
> actual receive data length is less than our default TCP receive buffer
size
> SO_RCVBUF (which is 8192 bytes), and our allocated receive data length is
> greater than 8192, and no multiplex I/O occurs?

As soon as you get data in your socket select will return.  Generally you
will get a full packet of information, which may or may not be the size of
your buffer.  It's a very good idea to make sure that your buffer size is
larger than your packet size.  On various machines I've seen MTUs (Maximum
Transmission Unit) from 56 to 4096.  Not sure what the AS/400 defaults at,
but packets are usually smaller than that anyway.

In other words, make your receive buffer large enough to hold enough data
that you can process when you cycle through and when you call select() and
wait it will return when it gets a packet or so of information (there are
lots of cases when it returns with less than a full packet size of
information, so don't even think about counting on the size returned without
looking at the variable).  If I have a client/server program, and on the
client I send the letter "a", that's what comes through and triggers select,
the single character "a".

HTH.

Regards,

Jim Langston


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.