Thank you Dan.
But my problem is that the method "readIb" is not executed and it does not
come to the line display.
Eval String3 = readIb(ib)




2012/3/12 Dan Kimmel <dkimmel@xxxxxxxxxxxxxxx>

Looks like you're going to have code page problems with this. Depends on
how you compile it and what code page your source is. If you have your
source in a source physical file, the code page is some flavor of EBCDIC.
The stuff in your input stream is most likely ASCII. DSPLY is going to
expect EBCDIC.

One way around this is to put your source in a IFS file with code page
1252 or something similar and compile from IFS stream file. RPG would then
do the work to translate to EBCDIC for your output to devices it knows like
those used by the DSPLY op code.

-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:
java400-l-bounces@xxxxxxxxxxxx] On Behalf Of Berto Gil
Sent: Monday, March 12, 2012 4:31 AM
To: java400-l@xxxxxxxxxxxx
Subject: Error socket

Good morning.
I am creating a client socket and do not manage to read the
inputStreamReader.

Even the line "Eval String3 = readIb(ib)" works perfectly.

Some solution?? Thank you.

IBUFFERED
d newBUFFERED PR O ExtProc(*JAVA:
d 'java.io.BufferedReader':
d *CONSTRUCTOR)
d
Class(*JAVA:'java.io.BufferedReader')
d ib O
d Class(*JAVA:'java.io.Reader')
**********************************************************************
d readIb PR O ExtProc(*JAVA:
d 'java.io.BufferedReader':
d 'read')
d Class(*JAVA:'java.lang.String')
**********************************************************************
d readIbLine PR O ExtProc(*JAVA:
d 'java.io.BufferedReader':
d 'readLine')
d Class(*JAVA:'java.lang.String')
**********************************************************************
d closeIB PR ExtProc(*JAVA:
d 'java.io.BufferedReader':
d 'close')

*********************************************************************



PROGRAM

h DftActGrp(*NO) ActGrp(*CALLER)
h thread(*serialize)
/Copy *libl/QRPGLESRC,MATHPR
/Copy *libl/QRPGLESRC,SOCKPR
/Copy *libl/QRPGLESRC,OSTREAMPR
/Copy *libl/QRPGLESRC,ISTREAMPR
/Copy *libl/QRPGLESRC,IBUFFERED
/Copy *libl/QRPGLESRC,ISTREAMBF
d IPadr c Const('10.232.1.40')
d Messa c Const('253')
d Port s 10I 0
*
d tmpIS s O
d
Class(*JAVA:'java.io.InputStream')
d tmpISR s O
d Class(*JAVA:'java.io.Input +
d
StreamReader')
d tmpOS s O
d
Class(*JAVA:'java.io.OutputStream')
d tmpBR s O
d
Class(*JAVA:'java.io.BufferedReader')
d string1 s O
d Class(*JAVA:'java.lang.String')
d string2 s O
d Class(*JAVA:'java.lang.String')
d string3 s O
d Class(*JAVA:'java.lang.String')
d Byte0 s O
d Class(*JAVA:'java.lang.Byte')
d Byte1 s O
d Class(*JAVA:'java.lang.Byte')
d Byte2 s O
d Class(*JAVA:'java.lang.Byte')
d ByteSend s O
d Class(*JAVA:'java.lang.Byte')
d Sum s O
d
Class(*JAVA:'java.math.BigDecimal')
d BigD1 s O
d
Class(*JAVA:'java.math.BigDecimal')
d BigD2 s O
d
Class(*JAVA:'java.math.BigDecimal')
d StringSum s O
d Class(*JAVA:'java.lang.String')
d Integer s O
d Class(*JAVA:'java.lang.Integer')
d Char s O
d
Class(*JAVA:'java.lang.Character')
d Display s 30A Varying
****************************
d Sock1 s O
d Class(*JAVA:'java.net.Socket')
*
d is s O Class(*JAVA:
d 'java.io.InputDataStream')
*
d ids s O Class(*JAVA:
d 'java.io.InputDataStream')
*
d os s O Class(*JAVA:
d 'java.io.OutputDataStream')
*
d ir s O Class(*JAVA:
d 'java.io.BufferedReader')
*
d ib s O Class(*JAVA:
d 'java.io.Reader')
*
d isb s O Class(*JAVA:
d 'java.io.InputStreamReader')
*
****************************
c Eval String1 = newString(IPadr)
c Eval String2 = newString(Messa)
c Z-add 10001 Port
c Eval Sock1 = newSocket(String1 : Port)
c* Eval Display = getBytes(String2)
*
*/free
* monitor;
* tmpOS=getOutput(Sock1);
* tmpBR=getInput(Sock1);
* os=newOSTREAM(tmpOS);
* writeBytes(os : String2);
* ib=newINSTREAMBF(tmpBR);
* ir=newBUFFERED(ib);
* on-error *all;
* endmon;
*/end-free
*
c* Display Dsply
*
c Eval tmpOS=getOutput(Sock1)
c Eval tmpIS=getInput(Sock1)
c Eval os=newOSTREAM(tmpOS)
c CallP writeBytes(os : String2)
c Eval isb=newINSTREAMBF(tmpIS)
c Eval ib=newBUFFERED(isb)
*
c Eval String3 = readIb(ib)
c Eval Display = getBytes(String3)
c Display Dsply
*
c CallP closeOS(os)
c CallP closeIB(ib)
c CallP closeSocket(Sock1)
c Eval *InLr = *On
--
This is the Java Programming on and around the IBM i (JAVA400-L) mailing
list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/java400-l.



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



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 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.