On 12/07/2012 05:29 AM, mjarco wrote:
> Hi,
> This topic returns to the group from time to time. Short answer is
> to Read() from connection and if Read() returns EOF it means
> connection is closed. For more detailed explanaitions please
> browse group archives
>
Hi Mjarco,
Thanks for your reply!
I did searched around the Internet and I did found some thread in this
mailing list related to this problem. However, none of them proposed a
solution suitable for me. Most of them, suggest to use Read() first to
test if the connectivity of a socket.
In my code, there are two goroutines, one for read from the socket and
one for write to the socket. If there are some data not been processed
by the read goroutine, the write goroutine may read the data from the
connection when test the connectivity using Read(). It may lead to data
corruption for the read goroutine.
I would like to know if this (write to closed net.TCPConn without
returning error) is a feature of net package or it should be considered
as a bug.
Regards,
-Monnand