🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #958

Re: an idea to consider

#958
From: John McGrath TeamB
Date: Thu, 11 Jul 2002 23:05
39 lines
2672 bytes
On Tue, 09 Jul 2002 18:16:35 -0400, Alan Shiers wrote:

> I've changed code in my test program to deal only with UTF-8 
> strings.  I was amazed that I was actually able to log onto
> my test program with telnet :)
> 
> This is a major lightbulb moment for me!

Yeah, it really makes things much nicer doesn't it?

> I set up my test program so that upon connection I output a 
> welcome message to the client (telnet).  
> 
> Then, in the test program, I enter in a while loop which is
> supposed to read in commands: String command = input.readUTF();
> 
> In telnet, I type "help" [ENTER]. Nothing happens...

Instead of a DataInputStream and DataOutputStream, use an 
InputStreamReader and an OutputStreamWriter.

> Why isn't the command I type in telnet being sent to my test 
> program after I hit the ENTER key?  What am I doing wrong?
> Do I have to tell the telnet program that I am expecting input
> from the user or something like that?

ReadUTF expects a 2-byte length at the front of the string, which is 
hard to send with Telnet.  For this approach, you would use normal 
Readers and Writers, and write code as if you are talking to a 
terminal.

-- 
Regards,

John McGrath [TeamB]

---------------------------------------------------
Before sending me e-mail, please read:
    http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID: <MPG.1797cf0b6fc31c7b98b81f@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!sn-xit-01!sn-xit-08!supernews.com!news-out.visi.com!hermes.visi.com!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!dnews
References: <3D279D25.59AA52E@hfx.eastlink.ca> <3d27a0b2_2@dnews> <3D2861BB.63220DF5@hfx.eastlink.ca> <MPG.17923b35889aef9498b7f9@newsgroups.borland.com> <3D28A22A.89CB73DC@hfx.eastlink.ca> <MPG.1793793e26a87ab98b7fd@newsgroups.borland.com> <3D29FE4E.C3EEF5B5@hfx.eastlink.ca> <MPG.1793eed4e5e42ee798b80b@newsgroups.borland.com> <3D2A48B8.29314379@hfx.eastlink.ca> <MPG.17946a495a7d5f5e98b812@newsgroups.borland.com> <3D2B05DA.EE3D2DC2@hfx.eastlink.ca> <3d2b2be9_2@dnews> <3D2B60C3.9D9006FA@hfx.eastlink.ca>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,4157c064c52214d4
X-Google-Attributes: gid1089d0,public
X-Google-ArrivalTime: 2002-07-11 16:19:18 PST
From: John McGrath  [TeamB] <ng-b@JPMcGrath.net>
Newsgroups: borland.public.jbuilder.java.api
Subject: Re: an idea to consider
Date: Thu, 11 Jul 2002 19:05:55 -0400
Message-ID: <MPG.1797cf0b6fc31c7b98b81f@newsgroups.borland.com>
References: <3D279D25.59AA52E@hfx.eastlink.ca> <3d27a0b2_2@dnews> <3D2861BB.63220DF5@hfx.eastlink.ca> <MPG.17923b35889aef9498b7f9@newsgroups.borland.com> <3D28A22A.89CB73DC@hfx.eastlink.ca> <MPG.1793793e26a87ab98b7fd@newsgroups.borland.com> <3D29FE4E.C3EEF5B5@hfx.eastlink.ca> <MPG.1793eed4e5e42ee798b80b@newsgroups.borland.com> <3D2A48B8.29314379@hfx.eastlink.ca> <MPG.17946a495a7d5f5e98b812@newsgroups.borland.com> <3D2B05DA.EE3D2DC2@hfx.eastlink.ca> <3d2b2be9_2@dnews> <3D2B60C3.9D9006FA@hfx.eastlink.ca>
X-Newsreader: MicroPlanet Gravity v2.60
NNTP-Posting-Host: 209.92.40.60
X-Trace: dnews 1026428754 209.92.40.60 (11 Jul 2002 16:05:54 -0700)
Lines: 39
X-Authenticated-User: jpmcgrath
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!sn-xit-01!sn-xit-08!supernews.com!news-out.visi.com!hermes.visi.com!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!dnews