#include	<stdio.h>
#include	<stdlib.h>
#include	<unistd.h>

#define	__USE_GNU																											// struct sockaddr_in
#include <arpa/inet.h>
#include	<fcntl.h>
#include	<signal.h>

#include	<string.h>
#include	<errno.h>

int	main()
{
	int				sock[1];																								// client sockets
	int				temp;

	//	---	handshake
	
	struct	sockaddr_in		faddrc;				memset(&faddrc, 0, sizeof(struct sockaddr_in));

					faddrc.sin_family			= AF_INET;
					faddrc.sin_addr.s_addr		= (uint32_t) inet_addr("127.0.0.1");
					faddrc.sin_port			= (uint16_t) htons(1024);
		
					sock[0]				= socket (AF_INET, SOCK_STREAM, 0);				if	(sock[0] == -1)	{ printf("Error calling socket() : %s\n", strerror(errno)); };
					temp				= connect(sock[0], &faddrc, sizeof(struct sockaddr_in));	if	(temp    == -1)	{ printf("Error calling connect(): %s\n", strerror(errno)); };				// SIGHUP on connect!!!
//	if	(sock[0] != -1)	{	sock[0]				= close(sock[0]);						if	(sock[0] == -1)	{ printf("Error calling close()  : %s\n", strerror(errno)); };	};			// prevent close() from sending SIGHUP

	while	(1)							sleep(1);																			// prevent exit()  from sending SIGHUP

	exit(EXIT_SUCCESS);																										// preferably send SIGHUP as one would send SIGCHLD
}

