VTKFIG  0.20.20181114
Easy VTK based in situ visualization
int vtkfig::internals::Communicator::ServerConnect ( const int  port)

Definition at line 25 of file vtkfigCommunicator.cxx.

26  {
27 
28  ssocket=vtkSmartPointer<vtkServerSocket>::New();
29 
30  int rc;
31  rc=ssocket->CreateServer(port);
32  // here, rc=0 means success...
33  if (rc) throw std::runtime_error("vtkServerSocket::CreateServer failed\n");
34 
35  rc=0;
36  int iretry=0;
37  while (iretry<server_listen_num_retry && rc==0)
38  {
39  if (iretry)
40  {
41  std::this_thread::sleep_for (std::chrono::milliseconds(server_listen_retry_timeout));
42  }
43  rc=WaitForConnection(ssocket,server_listen_waiting_time);
44  iretry++;
45  }
46  if (!rc) return rc;
47 
48  rc=Handshake();
49  if (!rc) throw std::runtime_error("Server handshake failed\n");
50 
51  return rc;
52  }
vtkSmartPointer< vtkServerSocket > ssocket