[BEEPwg] About beep output and input stream

Russell Hung rhung@visionsolutions.com
Tue, 6 Aug 2002 11:44:22 -0700


This is a multi-part message in MIME format.

------_=_NextPart_001_01C23D79.47CBC44E
Content-Type: multipart/alternative;
	boundary="----_=_NextPart_002_01C23D79.47CBC44E"


------_=_NextPart_002_01C23D79.47CBC44E
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hi,
=20
I have a question about the input and output stream of BEEP. I read the
example on the book, "BEEP", written by Dr. Marshall T. Rose and
published by O'Reilly. There is a client example on page 52:
=20
try {
    channel.sendMSG(new StringOutputDataStream(request), reply);
} catch { ....}
=20
InputDataStream ds =3D reply.getNextReply().getDataStream();
InputStream is =3D ds.getInputStream();
=20
while(is.read() !=3D -1) {
    ++replyLength;
}=20
=20
It uses the message reply object to get the input stream. That means we
have to send a message and wait for the response. This is not what I
want. What I need are two independent threads: one for listening to the
port/messages and one for sending out the message through the port. Is
there any way to have an independent InputStream? Thanks.=20
=20
Best Regards,
=20
Russell Hung
rhung@visionsolutions.com
=20

------_=_NextPart_002_01C23D79.47CBC44E
Content-Type: text/html;
	charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE id=3DridTitle>Message</TITLE>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<STYLE>BODY {
	MARGIN-TOP: 25px; FONT-SIZE: 10pt; MARGIN-LEFT: 15px; COLOR: #993300; =
FONT-FAMILY: Arial, Helvetica
}
</STYLE>

<META content=3D"MSHTML 6.00.2712.300" name=3DGENERATOR></HEAD>
<BODY id=3DridBody background=3Dcid:632492218@06082002-2D99>
<DIV><SPAN class=3D632492218-06082002>Hi,</SPAN></DIV>
<DIV><SPAN class=3D632492218-06082002></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D632492218-06082002>I have a question about the input =
and output=20
stream of&nbsp;BEEP. I read the example on the book, "BEEP", =
written&nbsp;by Dr.=20
Marshall T. Rose and&nbsp;published by O'Reilly. There is a =
client&nbsp;example=20
on page 52:</SPAN></DIV>
<DIV><SPAN class=3D632492218-06082002></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D632492218-06082002>try {</SPAN></DIV>
<DIV><SPAN class=3D632492218-06082002>&nbsp;&nbsp;&nbsp; =
channel.sendMSG(new=20
StringOutputDataStream(request), reply);</SPAN></DIV>
<DIV><SPAN class=3D632492218-06082002>} catch { ....}</SPAN></DIV>
<DIV><SPAN class=3D632492218-06082002></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D632492218-06082002>InputDataStream ds =3D=20
reply.getNextReply().getDataStream();</SPAN></DIV>
<DIV><SPAN class=3D632492218-06082002>InputStream is =3D=20
ds.getInputStream();</SPAN></DIV>
<DIV><SPAN class=3D632492218-06082002></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D632492218-06082002>while(is.read() !=3D -1) =
{</SPAN></DIV>
<DIV><SPAN class=3D632492218-06082002>&nbsp;&nbsp;&nbsp;=20
++replyLength;</SPAN></DIV>
<DIV><SPAN class=3D632492218-06082002>} </SPAN></DIV>
<DIV><SPAN class=3D632492218-06082002></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D632492218-06082002>It uses the message reply object =
to get the=20
input stream. That means we have to send a message and wait for the =
response.=20
This is not what I want. What I need&nbsp;are two independent threads:=20
one&nbsp;for listening to the port/messages and one for sending out the =
message=20
through the&nbsp;port. Is there any way to have an independent =
InputStream?=20
Thanks. </SPAN></DIV>
<DIV><SPAN class=3D632492218-06082002></SPAN>&nbsp;</DIV>
<DIV><SPAN class=3D632492218-06082002>Best Regards,</SPAN></DIV>
<DIV><SPAN class=3D632492218-06082002></SPAN>&nbsp;</DIV>
<DIV align=3Dleft><FONT color=3D#8a315b>Russell Hung</FONT></DIV>
<DIV align=3Dleft><FONT color=3D#7c0c7c><A=20
href=3D"mailto:rhung@visionsolutions.com">rhung@visionsolutions.com</A></=
FONT></DIV>
<DIV align=3Dleft>&nbsp;</DIV></BODY></HTML>
=00
------_=_NextPart_002_01C23D79.47CBC44E--

------_=_NextPart_001_01C23D79.47CBC44E
Content-Type: image/jpeg;
	name="Leaves Bkgrd.jpg"
Content-Transfer-Encoding: base64
Content-ID: <632492218@06082002-2D99>
Content-Description: Leaves Bkgrd.jpg
Content-Location: Leaves%20Bkgrd.jpg

/9j/4AAQSkZJRgABAgEASABIAAD/7QZAUGhvdG9zaG9wIDMuMAA4QklNA+0AAAAAABAASAAAAAEA
AQBIAAAAAQABOEJJTQPzAAAAAAAIAAAAAAAAAAA4QklNBAoAAAAAAAEAADhCSU0nEAAAAAAACgAB
AAAAAAAAAAI4QklNA/UAAAAAAEgAL2ZmAAEAbGZmAAYAAAAAAAEAL2ZmAAEAoZmaAAYAAAAAAAEA
MgAAAAEAWgAAAAYAAAAAAAEANQAAAAEALQAAAAYAAAAAAAE4QklNA/gAAAAAAHAAAP//////////
//////////////////8D6AAAAAD/////////////////////////////A+gAAAAA////////////
/////////////////wPoAAAAAP////////////////////////////8D6AAAOEJJTQQIAAAAAAAQ
AAAAAQAAAkAAAAJAAAAAADhCSU0ECQAAAAAEzwAAAAEAAACAAAAAgAAAAYAAAMAAAAAEswAYAAH/
2P/gABBKRklGAAECAQBIAEgAAP/+ACdGaWxlIHdyaXR0ZW4gYnkgQWRvYmUgUGhvdG9zaG9wqCA0
LjAA/+4ADkFkb2JlAGSAAAAAAf/bAIQADAgICAkIDAkJDBELCgsRFQ8MDA8VGBMTFRMTGBEMDAwM
DAwRDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAENCwsNDg0QDg4QFA4ODhQUDg4ODhQRDAwM
DAwREQwMDAwMDBEMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwM/8AAEQgAgACAAwEiAAIRAQMR
Af/dAAQACP/EAT8AAAEFAQEBAQEBAAAAAAAAAAMAAQIEBQYHCAkKCwEAAQUBAQEBAQEAAAAAAAAA
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