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



Scott,
Thanks again for the informative response.
I have just started getting into sockets programming, and you tutorials and
responses to my questions have helped enormously.


Jeff Young
Sr. Programmer Analyst

On Thu, Aug 20, 2015 at 12:07 PM, Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx>
wrote:

Jeff,

Each socket has a read buffer and a write buffer. When you do a send() or
write() to a socket, it will be placed in the buffer if there's enough
space, and your program will not need to wait for the data to actually
traverse the network.

In blocking mode, if there is not enough space in the write buffer, the
program will stop and wait until space is available, and the send/write
call will only return control to your program after space has been made
available in the buffer.

In non-blocking mode, if there's space in the buffer, it will work just
like blocking mode, but if there isn't space in the buffer it will return
only as many bytes as could be successfully placed in the buffer (i.e. the
return value from send() or write() will be smaller than the mount you
asked to write) and errno will be set to EWOULDBLOCK to let you know why
the data couldn't be written.

If you get EWOULDBLOCK, you can use the select() API to wait until there's
space again by waiting until the buffer is writeable.

I'm not familiar with your application, so I can't tell you if this would
have an "adverse affect", but I would recommend using non-blocking all of
the time, and using select() when necessary to wait for stuff to be ready.
This makes your programs MUCH more robust in my experience.




On 8/20/2015 10:57 AM, Jeff Young wrote:

I have read the tutorial the Scott Klement has regarding using Non-blocked
sockets to test for timeouts on a recv function.
I have a client socket program that connects to a server, sends data and
then waits for a reply on the same socket that it sent the data on.
If I set the socket to Non-Blocked at the start of the program, will it
have any adverse effect on my send of data or will it only effect the
receive?

TIA


Jeff Young
Sr. Programmer Analyst


--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.