[Mono-dev] [Mono-list] serial port problem

Leszek Ciesielski skolima at gmail.com
Thu Jan 25 05:54:40 EST 2007


On 1/21/07, Victor Rocha <rocha.pusch at gmail.com> wrote:
> Hello Carlos, Leszek
>
> I got a "Serial Chat" example from the web, and modified it in order
> to find what could be wrong with serial port. I noticed that
> "ReadLine()" works ok, while "Read()" doesn't...
>
> short explanation for the files attached:
> - serialChat_ReadLine.cs: Just works fine!!! (uses the ReadLine() function)
> - serialChat_Read.cs: Could not read anything from the port... (uses
> the Read() function)
>
> i also included files named as "xxx_nodetect.cs", which are same as
> above, but port detection is commented-out (so it runs in windows).
>
> I downloaded mono from SVN and patched it with this file from bugzilla:
> http://bugzilla.ximian.com/showattachment.cgi?attach_id=18521
>
> After patching and building, I still couldn't get Read() working....
>
> Please could you test this at your computers? maybe I could be doing
> something wrong, or maybe it's something with my system. If you can
> succeed with byte reading, using these files, I'll just start again
> from a "clean" linux installation...
>
> thank you very much for your attention!!!
>
> best regards
> Victor Rocha
> Florianopolis, Brazil
>
>
>

Hi all,

Well the problem is definitely not BSD-specific (as I have wrongly
suggested). On windows and linux, with your code (which is the example
from http://msdn2.microsoft.com/en-us/library/system.io.ports.serialport.aspx
, right?) I get the same problem as you did - ReadByte or
Read(byte[],..) throw Timeouts (after the timeout interval) instead of
reading available data. Strange thing is - I cannot replicate this bug
with smaller test case. There is something fishy with the code.

What's more - the same problem exists with MS.Net! So while it looks
like a bug, it is behaviour shared between mono and MS.Net.

Can someone else look into the attached examples?

-- 
MS-DOS user since 5.0
Windows user since 3.11
Linux user since kernel 2.4
Novell Netware user since 2.2
WARCRAFT user since 1.0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: serialChat_ReadLine.cs
Type: application/octet-stream
Size: 4901 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070125/44264922/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: serialChat_Read.cs
Type: application/octet-stream
Size: 4989 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070125/44264922/attachment-0001.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: serialChat_ReadLine_nodetect.cs
Type: application/octet-stream
Size: 5092 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070125/44264922/attachment-0002.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: serialChat_Read_nodetect.cs
Type: application/octet-stream
Size: 5184 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070125/44264922/attachment-0003.obj 


More information about the Mono-devel-list mailing list