#include #include #include #include #include "definitions.h" #include "net.h" #define COMMAND_LENGTH 80 /* max length of a command. */ int main() { int i=1; int status=FAILURE; char *command=NULL; char **reply=NULL; int ITEM=0; if ((command = (char *) calloc(COMMAND_LENGTH, sizeof(char)))==NULL) { fprintf(stderr, "*ERROR* failed to allocate command buffer!"); fflush(stderr); exit(EXIT_FAILURE); } if ((reply = (char **) calloc(COMMAND_LENGTH, sizeof(char *))) == NULL) { fprintf(stderr, "*ERROR* failed to allocate command buffer!"); fflush(stderr); exit(EXIT_FAILURE); } for (i=0; i 10)) { printf(" Entry out of range!\n"); exit(EXIT_FAILURE); } sprintf(command, "STRTK %d", ITEM); printf("The command is \"%s\"\n", command); status = vrsi_command_tcpip(command, reply, (int) COMMAND_LENGTH,1,"10.212.212.121",5001); if (status != SUCCESS) { fprintf(stderr,"*ERROR* failed to send command %s\n", command); fflush(stderr); exit(EXIT_FAILURE); } if (reply != NULL) { printf("Received the reply:\n\t%s\n",reply[0]); } exit(EXIT_SUCCESS); }