/* Neutr */

#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>

struct sockaddr_in address;
struct in_addr inaddr;
struct hostent * host;
int sock;
int port = 20000;
int n=0;
fd_set fds;
struct timespec czas;
char server[] = "localhost";
char bufor;

/* wiadomo co :) */
int polacz ( unsigned char * nazwa , int port )
{

    bzero( (char *)&address , sizeof(address));
    
    if (!(host = gethostbyname(nazwa)))
        {
        perror("Hostname lookup failure");
        return 0;
	}

    if ((sock = socket(PF_INET, SOCK_DGRAM, 0)) <0)
        {
        perror("Unable to open socket");
        return 0;
        }

    address.sin_family = AF_INET;
    address.sin_port = htons(port);
    
    memcpy(&address.sin_addr, host->h_addr_list[0], sizeof(address.sin_addr));

    if (connect(sock, (struct sockaddr *) &address, sizeof(address)))
        {
        return 0;
        }

return 1;
}


int main ( void )
{
    n=polacz(server,port);

    while(1)
    {
	/* nadawanie */
	write(sock,"a",1);
    }

    return 1;
}
