35 if (this->GetState() != Setup)
37 mitkThrowException(mitk::Exception) <<
38 "Can only try to open the connection if in setup mode. State was " << this->GetState();
42 std::string hostname = this->GetHostname();
43 int portNumber = this->GetPortNumber();
45 if (portNumber == -1 || hostname.size() <= 0)
48 MITK_WARN <<
"Port number or hostname was not correct";
53 m_Socket = igtl::ClientSocket::New();
56 int response =
dynamic_cast<igtl::ClientSocket*
>(m_Socket.GetPointer())->
57 ConnectToServer(hostname.c_str(), portNumber);
62 MITK_ERROR <<
"The client could not connect to " << hostname <<
" port: " << portNumber;
67 this->SetState(Ready);
70 this->InvokeEvent(NewClientConnectionEvent());