WIP: refactor socket/ip connections