]> git.pond.sub.org Git - empserver/blobdiff - src/client/host.c
Update copyright notice
[empserver] / src / client / host.c
index 4eff2d8aa10edfd7789b6e3cdbfc177f495c5056..68df7e21f8d43c71efdfcc105dede145687916d4 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2009, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -26,7 +26,7 @@
  *  ---
  *
  *  host.c: make stream connection to empire
- * 
+ *
  *  Known contributors to this file:
  *     Dave Pare, 1989
  *     Steve McClure, 1998
 #include <stdlib.h>
 #include <string.h>
 #ifndef _WIN32
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
 #include <arpa/inet.h>
 #include <netdb.h>
-#include <netinet/in.h>
-#include <sys/socket.h>
 #include <unistd.h>
 #else
-#include <io.h>
+#define close(fd) w32_close_socket((fd))
 #endif
 #include "misc.h"
 
@@ -81,7 +82,6 @@ tcp_connect(char *host, char *serv)
 
        if (connect(sockfd, res->ai_addr, res->ai_addrlen) == 0)
            break;              /* success */
-
        close(sockfd);          /* ignore this one */
     } while ((res = res->ai_next) != NULL);
 
@@ -142,16 +142,10 @@ hostconnect(struct sockaddr_in *addr)
 
     s = socket(AF_INET, SOCK_STREAM, 0);
     if (s < 0) {
-#ifdef _WIN32
-       errno = WSAGetLastError();
-#endif
        return -1;
     }
     addr->sin_family = AF_INET;
     if (connect(s, (struct sockaddr *)addr, sizeof(*addr)) < 0) {
-#ifdef _WIN32
-       errno = WSAGetLastError();
-#endif
        (void)close(s);
        return -1;
     }