[Mono-list] C#/Mono Serial port communication

Gonzalo Paniagua Javier reply.to.the.list.iam.suscribed@notexists.ximian.com
Wed, 24 Nov 2004 16:17:44 -0500


On Wed, 2004-11-24 at 18:46 +0100, Jon-Eirik Pettersen wrote:
> I have created a simple application to try this, but it does not seem to 
> work.
> 
> using System;
> using System.IO;
> 
> namespace serialchattest {
>    class serialchattest {
>      static string device = "/dev/rfcomm0";
> 
>      static void Main() {
>        using (FileStream fs = new FileStream(device, FileMode.Open, 
> FileAccess.ReadWrite)) {
>          using (StreamReader sr = new StreamReader(fs)) {
>            using (StreamWriter sw = new StreamWriter(fs)) {
>              sw.WriteLine("AT");
>              Console.Write(sr.ReadLine());
>            }
>          }
>        }
>      }
>    }
> }
> 
> Result:
> 
> Unhandled Exception: System.IO.IOException: Win32 IO returned 
> ERROR_SEEK. Path: /dev/rfcomm0
> in <0x00083> System.IO.FileStream:FlushBuffer ()
> in <0x0004f> (wrapper remoting-invoke-with-check) 
> System.IO.FileStream:FlushBuffer ()
> in <0x00043> System.IO.FileStream:Flush ()
> in <0x00061> System.IO.StreamWriter:Flush ()
> in <0x00025> System.IO.StreamWriter:Dispose (bool)
> in <0x00010> System.IO.TextWriter:System.IDisposable.Dispose ()
> in <0x000f3> serialchattest.serialchattest:Main ()
> 

That looks a bug in mono. Please file a bug report in
bugzilla.ximian.com.

-Gonzalo