added client side socket handling. still need to be added.