|
Jane,
I had the same issue of wanting to know if there was anything to read
before I actually committed to reading the socket descriptor. Since
the read does not have a timeout parm, if you commit to read and there
is nothing there, you are stuck.
I used the API called poll() to check the status of the descriptor
before I issued the recv()
Poll() is a little tricky because it expects a pointer to an array of
descriptors and the status of each descriptor you want to check,
rather than a single descriptor and status. Then it return the number
of descriptor that match the status you ask for.
If you think it will work for you I can track down my prototype and a
snip of code.
Charlie
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Jane Taubman
Sent: Wednesday, September 18, 2013 2:57 AM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: TCP/IP Buffer to variable in Scott Klement's sample
Thanks all, I ended up using the %SUBST on the recbuf field and used
it's length to eval the data into the Q field and that seemed to fix
the problem,
I have a second problem if anyone knows a quick answer. The readln()
function waits for data to arrive, but I need to be able to check for
data arriving with out waiting, eg
While socket open do
if data in buffer then
readline
else
read down data Queue don't wait
if data then send down socket
end
end
Does anyone know how I can check for data with out reading it.
Thanks again for the help
--
Jane.
--
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.
--
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 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.