implementation of basic connection to server in connection.cpp