version 1.2.2.4, 2012/04/27 16:41:56
|
version 1.2.2.5, 2012/05/01 22:30:31
|
Line 93 main(int argc, char **argv)
|
Line 93 main(int argc, char **argv)
|
ait_val_t val; |
ait_val_t val; |
u_short port = atoi(MQTT_PORT); |
u_short port = atoi(MQTT_PORT); |
mqtt_subscr_t *sub; |
mqtt_subscr_t *sub; |
int sock, ret = 0; | int ret = 0; |
char *str, szStr[STRSIZ], szLogName[MAXPATHLEN] = { 0 }; |
char *str, szStr[STRSIZ], szLogName[MAXPATHLEN] = { 0 }; |
FILE *lf; |
FILE *lf; |
|
|
Line 225 main(int argc, char **argv)
|
Line 225 main(int argc, char **argv)
|
printf("Connecting to %s:%d ... ", io_n2addr(&args->addr, &val), io_n2port(&args->addr)); |
printf("Connecting to %s:%d ... ", io_n2addr(&args->addr, &val), io_n2port(&args->addr)); |
AIT_FREE_VAL(&val); |
AIT_FREE_VAL(&val); |
|
|
if ((sock = InitClient()) == -1) { | if (!(args->cli = mqtt_cli_Open(&args->addr.sa))) { |
args->free(args); |
args->free(args); |
free(args); |
free(args); |
return 2; |
return 2; |
} |
} |
|
|
switch ((ret = ConnectClient(sock))) { | switch ((ret = ConnectClient(args->cli->sock))) { |
case -1: |
case -1: |
printf(">> FAILED!\n"); |
printf(">> FAILED!\n"); |
break; |
break; |
Line 261 main(int argc, char **argv)
|
Line 261 main(int argc, char **argv)
|
else |
else |
lf = stdout; |
lf = stdout; |
if (lf) { |
if (lf) { |
ret = Subscribe(sock, lf); | ret = Subscribe(args->cli->sock, lf); |
fclose(lf); |
fclose(lf); |
} else |
} else |
printf("Error:: in subscribe file #%d - %s\n", errno, strerror(errno)); |
printf("Error:: in subscribe file #%d - %s\n", errno, strerror(errno)); |
CloseClient(sock); | } else |
} else { | |
close(sock); | |
ret = 3; |
ret = 3; |
} | |
| mqtt_cli_Close(&args->cli); |
|
|
args->free(args); |
args->free(args); |
free(args); |
free(args); |