File:  [ELWIX - Embedded LightWeight unIX -] / mqtt / src / client.c
Revision 1.1.2.1: download - view: text, annotated - select for diffs - revision graph
Tue Dec 13 08:43:51 2011 UTC (12 years, 6 months ago) by misho
Branches: mqtt1_0
add new files

    1: #include "global.h"
    2: #include "mqtt.h"
    3: 
    4: 
    5: int
    6: InitClient(void)
    7: {
    8: 	int sock;
    9: 
   10: 	sock = socket(args->addr.sa.sa_family, SOCK_STREAM, IPPROTO_TCP);
   11: 	if (sock == -1) {
   12: 		printf("Error:: socket() #%d - %s\n", errno, strerror(errno));
   13: 		return -1;
   14: 	}
   15: 	if (connect(sock, &args->addr.sa, args->addr.sa.sa_len) == -1) {
   16: 		printf("Error:: connect() #%d - %s\n", errno, strerror(errno));
   17: 		return -1;
   18: 	}
   19: 
   20: 	return sock;
   21: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>