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

#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;
}

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