Say I open a connection to a server like:
conn, _ := net.DialTimeout("tcp", "127.0.0.1:2121", 10000000)
and I do some stuff and then call
conn.Close()
that's option 1. But what if I don't call Close on the conn and just call
os.Exit(1)
leaving the connection still open. That's option 2. i.e. I'm trying to simulate a user uploading a file and either reaching the ending and really Closing the connection... or ending the stream being writen to the socket but never officially closing it.
Back on the server side, is there anyway to tell which event happened? The good Close or the bad one?
Does net.Listener
have like some sort of callback to let me know. Because when I just call:
n, err := serverConn.Read()
I get an EOF err in either case, good or bad.