gclib  528
Communications API for Galil controllers and PLCs
remote_client_example.cpp
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  GError(gr, buf, G_SMALL_BUFFER); //Get Error Information
32  cout << buf << '\n';
33  rc = GALIL_EXAMPLE_ERROR;
34  }
35 
36  std::cout << "Enter any key to exit" << std::endl;
37  std::getchar();
38  return rc;
39 }
int main(int argc, char *argv[])
Main function for Commands Example.
GReturn remote_client()
Lists available remote servers and allows connection to remote server.
GCLIB_DLL_EXPORTED void GCALL GError(GReturn rc, GCStringOut error, GSize error_len)
Provides a human-readable description string for return codes.
Definition: gclibo.c:445
#define G_SMALL_BUFFER
Most reads from Galil are small. This value will easily hold most, e.g. TH, TZ, etc.
Definition: gclib.h:87
int GReturn
Every function returns a value of type GReturn. See gclib_errors.h for possible values.
Definition: gclib.h:91