-
Socket I/O
I am trying to work with Socket IO. I know you can read byte data via the
getInputStream() method but is there a way to read character data from the
socket ?
Thanks
Greg
-
Re: Socket I/O
You read the bytes into a byte array and then convert them to String, using
the constructor that takes a byte array as its parameter.
PC2
"Greg" <gjtaylor@tycoelectronics.com> wrote in message
news:3af2a00a$1@news.devx.com...
>
> I am trying to work with Socket IO. I know you can read byte data via the
> getInputStream() method but is there a way to read character data from the
> socket ?
>
>
> Thanks
> Greg
-
Re: Socket I/O
"Greg" <gjtaylor@tycoelectronics.com> wrote:
>
>I am trying to work with Socket IO. I know you can read byte data via the
>getInputStream() method but is there a way to read character data from the
>socket ?
>
>
>Thanks
>Greg
Greg,
You can wrap some 'reader' stream around the Input stream obtained from the
getInputStream() method as follow:
InputStreamReader isr = new InputStreamReader ( sock.getInputStream()
);
and then issue reads against 'isr'.
Lewis, Toronto
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks