version 1.2.2.3, 2012/04/16 00:09:57
|
version 1.2.2.4, 2012/05/01 22:30:31
|
Line 122 main(int argc, char **argv)
|
Line 122 main(int argc, char **argv)
|
char ch; |
char ch; |
ait_val_t val; |
ait_val_t val; |
u_short port = atoi(MQTT_PORT); |
u_short port = atoi(MQTT_PORT); |
int sock, ret = 0; | int ret = 0; |
|
|
if (!(args = malloc(sizeof(struct tagArgs)))) { |
if (!(args = malloc(sizeof(struct tagArgs)))) { |
printf("Error:: in alloc arguments #%d - %s\n", errno, strerror(errno)); |
printf("Error:: in alloc arguments #%d - %s\n", errno, strerror(errno)); |
Line 229 main(int argc, char **argv)
|
Line 229 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; |
} |
} |
|
|
if (args->isFile && !OpenFile()) { |
if (args->isFile && !OpenFile()) { |
|
mqtt_cli_Close(&args->cli); |
args->free(args); |
args->free(args); |
free(args); |
free(args); |
return 3; |
return 3; |
} |
} |
|
|
switch ((ret = ConnectClient(sock))) { | switch ((ret = ConnectClient(args->cli->sock))) { |
case -1: |
case -1: |
printf(">> FAILED!\n"); |
printf(">> FAILED!\n"); |
break; |
break; |
Line 266 main(int argc, char **argv)
|
Line 267 main(int argc, char **argv)
|
} |
} |
|
|
if (ret == MQTT_RETCODE_ACCEPTED) { |
if (ret == MQTT_RETCODE_ACCEPTED) { |
ret = !(Publish(sock) == args->MsgID); | ret = !(Publish(args->cli->sock) == args->MsgID); |
CloseClient(sock); | } else |
} else { | |
close(sock); | |
ret = 4; |
ret = 4; |
} | |
| mqtt_cli_Close(&args->cli); |
|
|
CloseFile(); |
CloseFile(); |
args->free(args); |
args->free(args); |