Why do you need to poll/select on sockets? why not just start a
goroutine for each connection and use channels to communicate where
necessary?
> Or another thing I've struggled with: try to parse a text file line-by-
> line... terrible.
> Why haven't they implemented os.File.ReadLine() ?
bufio.ReadBytes / bufio.ReadString are great for this
Since there isn't a setTimeout() for the windows port yet, I guess
you'll have to wait until it's implemented or implement it yourself.
The windows port lags behind the *nix ports because the core
developers aren't windows developers.
But setTimeout() shouldn't be essential. In the rare case where the
other end of a connection maintains the connection while never sending
any data is not really something to worry about unless it's public
facing production code, which given the state of the windows port is
probably not recommended yet.
Go doesn't need poll/select because it already uses them under the
hood. A lot of the method calls that block a go-routine are
asynchronous calls to the system.
The Read() method you're using is using poll/select and is
non-blocking from the program's perspective, but is blocking from the
go-routine's perspective.
If you want to do other things while waiting for the Read() to
complete then launch more go-routines.
- jessta
--
=====================
http://jessta.id.au