I think this will prove useful to you:


I wrote the library specifically for applications like the one you are
and it has worked quite well for me.

Give it a try...

On Sunday, October 26, 2014 11:10:33 AM UTC+2, Quoc-Viet Nguyen wrote:

Hi everyone,

I'm learning go by implementing modbus protocol [1]. It is pretty usable
but only tested against a simulator at the moment.

However, I'm facing a problem with detecting data available from serial
port fd.
In order to have a sort of reading timeout, I have to use a silly


And I'm considering to use syscall.Select on the file fd, which is like:

var rfds syscall.FdSet
FD_SET(file.Fd(), rfds)
n, err := syscall.Select(int(file.Fd()) + 1, &rfds, nil, nil, &timeout)

But I'm not sure how to implement FD_SET here. I searched through the
forum but haven't found the answer or any example of using select.
Do we have an alternative way to have a SetReadDeadline for File like Conn
in net package?

Thank you

[1] https://github.com/goburrow/modbus
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Discussion Posts


Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 28 | next ›
Discussion Overview
groupgolang-nuts @
postedOct 26, '14 at 9:10a
activeOct 27, '14 at 7:01p



site design / logo © 2022 Grokbase