gclib  2.0.8
Communications API for Galil controllers and PLCs
remote_client_example.cpp
Go to the documentation of this file.
1 
9 #include "examples.h"
10 
11 #include <iostream> //std::cout
12 
13 using namespace std;
14 
16 
19 int main(int argc, char * argv[])
20 {
21  char buf[G_SMALL_BUFFER];
22  int rc = GALIL_EXAMPLE_OK;
23 
24  try
25  {
26  //Demonstrates various uses of GListServers() and GSetServer().
27  remote_client();
28  }
29  catch (GReturn gr)
30  {
31  error(nullptr, gr); //see examples.h for error handling
32  pause();
33  return GALIL_EXAMPLE_ERROR;
34  }
35 
36  pause();
37  return GALIL_EXAMPLE_OK;
38 }
int GReturn
Every function returns a value of type GReturn. See gclib_errors.h for possible values.
Definition: gclib.h:93
#define G_SMALL_BUFFER
Most reads from Galil are small. This value will easily hold most, e.g. TH, TZ, etc.
Definition: gclib.h:89
int main(int argc, char *argv[])
Main function for Commands Example.
GReturn remote_client()
Lists available remote servers and allows connection to remote server.
void error(GCon g, GReturn rc)
An example of error handling and debugging information.
Definition: examples.h:40
int pause()
Pauses console apps for a user key stroke.
Definition: examples.h:62