All pastes #676114 Raw Edit

Someone

public text v1 · immutable
#676114 ·published 2007-08-30 19:58 UTC
rendered paste body
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <netdb.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <gtk/gtk.h>
#include <fcntl.h>
#include "conf.h"
#include "globales.h"
#include "log.h"
#include "options.h"
#include "sockets.h"
#include "window.h"
#include "timestamp.h"
#include "main.h"


struct 	sockaddr_in address;

int func_connect(int argc, char *argv[]) {
	
		if (read_arguments(argc, argv, &address, "tcp") < 0) {
			exit(EXIT_FAILURE);
			}
			address.sin_family = AF_INET;
		if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
			perror("Socket error");
			exit(EXIT_FAILURE);
			}
		if (connect(sockfd, (struct sockaddr *) &address, sizeof (struct sockaddr_in)) < 0) {
			perror("Connect error");
			exit(EXIT_FAILURE);
			}
	return EXIT_SUCCESS;
	}


int main(int argc, char *argv[])
{
	func_connect(argc, argv);
	g_idle_add((GSourceFunc)read_socket, (GtkWidget*) textview1);
	gtk_init(&argc, &argv);
	init_gtk();
	
  return EXIT_SUCCESS;
}