working, but need to prevent sockets from going out of scope somehow