You want to specify Encoding.ASCII in the StreamWriter ctor.  Otherwise some 
arbitrary encoding will be used (Encoding.Default).  And if it's UTF-8 then 
you'll get the Unicode BOM preamble first.

Note that in the original code the 'other' two StreamWriter instances are 
created and then immediately discarded -- after first reading a value that was 
available directly...  Wierd.  Do as Alan suggested but supply Encoding.ASCII 
as the second argument.

Andy


> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Phillip N.
> Sent: 04 December 2007 13:29
> To: Alan McGovern
> Cc: [email protected]
> Subject: Re: [Mono-list] TCPClient not normal bevaiour
> 
> Hi alan,
> 
> Thanks for your response.
> 
> Actually, it think its bizarre too, but it the way a library 
> im using does it. :)
> 
> [EMAIL PROTECTED], sudgested it could be a encoding problem.
> 
> And its true.. LANG=C does solve the thing.
> 
> 
> Anyway, is this a bug?
> 
> 
> thanks!
> 
> El mar, 04-12-2007 a las 21:07 +0000, Alan McGovern escribió:
> > Attach a compilable testcase so the behavior can be 
> checked. That'll 
> > make it easier to spot the issue. The only thing i'd say is 
> that the 
> > way you've created the streamwriter is probably the most 
> bizarre way 
> > i've ever seen. It's identical to this:
> > 
> > StreamWriter writer = new StreamWriter(socket.GetStream());
> > 
> > except you're creating two additional streamwriters for 
> some unknown 
> > reason. The additional bytes could be a byte order mark. 
> What happens 
> > if you do a .Receive() in c#, do you get just the 5 bytes?
> > 
> > Alan.
> > 
> --
> Phillip N. <[EMAIL PROTECTED]>
> 
> _______________________________________________
> Mono-list maillist  -  [email protected] 
> http://lists.ximian.com/mailman/listinfo/mono-list
> 

_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to