implement an event registering and listening system through TCP