If you get a 0 on recv(), that means that server has shut down the
connection (I think. Scott would know it for sure). If this assumption
is right and you think server should send you more data, then, yes, you
probably want to check with vendor on why their server is shutting down
the connection before sending all the data.
As far as rdline gives you -1 and recv() gives you 0, well, rdline is
coded to return caller with -1 if recv() returned value is less than 1
and there is no data in the buff (2nd/3rd parm in rdline).
As far as errno, see Scott's reply.
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Christopher Anderson
Sent: Wednesday, February 06, 2008 11:59 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: TCP/IP Sockets from RPG
Thanks everyone for the help. It seems that if I do a receive I get a
return value of '0' but when I do a rdline I get a '-1'
When I attempt to 'eval errno' I get the message "Type Error Occurred."
As for knowing what to read, I know the record formats and can, with
each record (xxx byte-long segment ended in LF) determine if THIS is the
last record as that information is stored internally so I know how much
to read. That isn't the problem. It just doesn't give me anything
back. I'm checking with the vendor to see if it is on their end but
presume it is on my end as I've never done this before.
It would really help if I could figure out what the errno was.
Thank you,
Chris Anderson
Partners Mutual Insurance
************************************************************************
***
*Ted,
*My comment is based on rdline procedure posted on Scott's web site
*
http://www.scottklement.com/rpg/socktut/readline.html.
*
*In rdline, it is coded to receive data one byte at a time. It returns
*control back to caller when buffer is full or lf is encountered. ==>
*The guesstimate thing that you mentioned is already handled by rdline.
*
*The only thing that I see in rdline that could give a clue on OP's
*problem is that rdline will return -1 when recv() return value is less
*than 1 and no data was being put to the buffer yet. The OP mentioned
*that he is having problem with errno (Not sure what kind of problem he
*is having). Anyway, that leads me to think that it might be because
*recv() is returning 0.
*
************************************************************************
**
As an Amazon Associate we earn from qualifying purchases.