basic tcp socket framework