first attempt to create connection between client and server. has bugs.