APIs to determine which end of the socket has closed it