Hi,
I'm using TcpClient for communication between two PC running a small
piece
of software. The protocol used has been designed internally and is
HTTP
similar (command line, headers, body). A typical response in this
protocol
would be:
SMP/1.0 200 OK<crlf>
User-Agent: foo<crlf>
Version: foo<crlf>
Content-Length: foo<crlf>
<crlf>
[BODY - binary or whatever]
To parse the response, I'm binding a StreamReader over the
TcpClient.Stream
(a NetworkStream). It is indeed much easier to parse the headers with
a
simple StreamReader.ReadLine(). Until now everything works fine.
But then, I need to read the body (the rest of the stream) using
binary
reading because it might well be a binary file. Trying to read
directly from
the NetworkStream or from the StreamReader.BaseStream (which are
supposedly
strictly the same) does not return anything. The buffer I use to read
remains
empty.
Why ? Is this that once a stream has been bound to a streamreader, I
MUST
use the streamreader until the end of the stream ?
To put it simply: my network stream has some content that should be
read as
text (Headers etc...) and another part that should be read as binary
content.
Any idea of how to implement that ?
Thanks in advance
Arno
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com