What about sending an empty frame (prefixed by identity frame) when a new connection is set up. This would work with connect and bind sockets. So when you receive an empty frame, we know the identity of the peer. When we send an empty frame, we close the connection.