Polling

I added everything that's needed for polling sockets and handling it's responses.