version 1.1.2.3, 2011/12/13 10:12:36
|
version 1.1.2.5, 2011/12/13 15:23:43
|
Line 21 InitClient(void)
|
Line 21 InitClient(void)
|
} |
} |
|
|
int |
int |
SendConnect(int sock) | try2Connect(int sock) |
{ |
{ |
return 0; | int siz = 0; |
| |
| siz = mqtt_msgCONNECT(args->msg, AIT_GET_STR(&args->ConnID), args->ka, |
| AIT_GET_STR(&args->User), AIT_GET_STR(&args->Pass), |
| args->Will.Topic.val.string, args->Will.Msg.val.string, |
| !args->notClear, args->QoS, args->Retain); |
| if (siz == -1) { |
| printf("Error:: msgCONNECT #%d - %s\n", mqtt_GetErrno(), mqtt_GetError()); |
| return -1; |
| } |
| |
| siz = send(sock, args->msg->msg_base, siz, 0); |
| if (siz == -1) { |
| printf("Error:: send() #%d - %s\n", errno, strerror(errno)); |
| return -1; |
| } else |
| VERB(3) printf("Sended CONNECT %d bytes\n", siz); |
| |
| register int i; |
| for (i = 0; i < siz; i++) |
| printf("%02x ", ((u_char*)args->msg->msg_base)[i]); |
| printf("\n"); |
| return siz; |
} |
} |