|
Subject: RE: TCP/IP Sockets from RPG> Date: Wed, 6 Feb 2008 11:21:42 -0600> From: Lim.Hock-Chai@xxxxxxxxxxxxxxx> To: rpg400-l@xxxxxxxxxxxx> > 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.> > > -----Original Message-----> From: rpg400-l-bounces@xxxxxxxxxxxx> [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Ted Slate> Sent: Wednesday, February 06, 2008 10:55 AM> To: rpg400-l@xxxxxxxxxxxx> Subject: RE: TCP/IP Sockets from RPG> > There are many(almost 20) error conditions that recv can return on the> i. A -1 return code means check errno for one of many conditions. In> fact, the end of a receive stream does not close a socket connection> unless an error should occur on the other end. If you get a 0 return> code(amount) then you can close the socket(your end) and re-connect> depending on the application. But as I stated before, the amount of> transmission send and receive should not be a guesstimate, so you should> know when to stop requesting data in some way shape or form. You cannot> just keep reading bytes until a return code less than 1.> > If you want to get started with socket programming on the i start here:> > http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/a> pis/aplist.htm> > > > > > Subject: RE: TCP/IP Sockets from RPG> Date: Wed, 6 Feb 2008 08:54:13 > > -0600> From: Lim.Hock-Chai@xxxxxxxxxxxxxxx> To: rpg400-l@xxxxxxxxxxxx>> > > > Looking at Scott's rdline example, seems like it will return a -1 > > when> recv() returned value is less than 1.> > You migth want to debug> > > rdline to see what is the actual value that> recv() returned. If it is> > > a 0, that means the server has disconnected> you connection.> > > > > > -----Original Message-----> From: rpg400-l-bounces@xxxxxxxxxxxx> > > [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Christopher > > Anderson> Sent: Monday, February 04, 2008 11:07 AM> To: > > rpg400-l@xxxxxxxxxxxx> Subject: TCP/IP Sockets from RPG> > > Good > > morning everyone,> > I've been attempting to create a socket > > connection to a report vendor> using Scott Klement's (hi Scott) > > tutorial on that subject. I've managed> to successfully establish the > > socket connection AND send the request> records downstream but the > > segment of the program that accepts the> response doesn't> work as I anticipated which leads me to believe I'm not> getting the> concept very well. > > What I need to do is accept a number of records> into the buffer until I> get an END TRANSMISSION record. Each record> will be the same length and> is identified internally. So, I'll grab one> record, decide what type it> is and process it then read the next record> from the buffer. I'm also> supposed to put a 60 second time out on this> segment of code but we'll> blow up that bridge later.> > The logic is:>> > DOU LastRecord = *On;> rc = rdline(sock: %addr(recbuf): %size(recbuf):> *On);> if rc < 0;> err = errno;> callp close(sock);> callp> die('rdline(): ' + %str(strerror(err)));> return;> endif;> > TestRecord> = recbuf; // This moves what's in the buffer into a> DS that can locate> the > // record type field.> // Process record.> > ENDDO;> > What> happens is the system works for a while on the rc=rdline... Line> then> returns -1 for rc and the errno variable comes back with an error> when> I at tempt to eval it in debug. (A type error). > > Does anyone have> any idea what I'm doing wrong or what I'm missing? > > Thank you,> Chris> Anderson> Partners Mutual Insurance> --> This is the RPG programming on> the AS400 / 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 AS400 / 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.>> _________________________________________________________________> Connect and share in new ways with Windows Live.> http://www.windowslive.com/share.html?ocid=TXT_TAGHM_Wave2_sharelife_012> 008> --> This is the RPG programming on the AS400 / 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 AS400 / 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.