connection not have closed flag, and use socket variable