Smr connect

From Rsewiki
struct smr *smr_connect(char *hostname, int port);

Smr_connect() establishes a connection to the smr daemon, [smrd], running on host hostname at TCP/IP port port.

The default host is the machine on which the program is running - this can be specified by passing a null pointer for hostname. The default port is 24901, this can be specified by passing zero for port.

If a connection is established, a pointer to a struct smr structure is returned. This can be used in subsequent calls to smr_read and smr_write. If a connection can not be established, a null pointer is returned.

Example

struct smr *robot;
robot = smr_connect(0, 0);  /* Default host and port */
if (robot == 0) {
  fprintf(stderr, "Can't connect to smr\n");
  exit(1);
}

When the connection is no longer needed, it can be terminated using smr_disconnect.