--- mqtt/src/client.c 2011/12/13 08:43:51 1.1 +++ mqtt/src/client.c 2011/12/13 08:43:51 1.1.2.1 @@ -0,0 +1,21 @@ +#include "global.h" +#include "mqtt.h" + + +int +InitClient(void) +{ + int sock; + + sock = socket(args->addr.sa.sa_family, SOCK_STREAM, IPPROTO_TCP); + if (sock == -1) { + printf("Error:: socket() #%d - %s\n", errno, strerror(errno)); + return -1; + } + if (connect(sock, &args->addr.sa, args->addr.sa.sa_len) == -1) { + printf("Error:: connect() #%d - %s\n", errno, strerror(errno)); + return -1; + } + + return sock; +}