Support for IPv6:
(tcp_listen, player_addrlen): New. IPv4-only code factored out of player_init(). (player_init): Use them. (player_accept): Address family independence. (tcp_connect): New. (main): Use it. (hostaddr, hostconnect, hostport): Internal linkage.
This commit is contained in:
parent
75a511a749
commit
19d88af312
7 changed files with 267 additions and 87 deletions
|
@ -49,7 +49,6 @@
|
|||
#endif
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <time.h>
|
||||
#ifndef _WIN32
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
|
@ -99,7 +98,6 @@ main(int ac, char **av)
|
|||
char *ptr;
|
||||
char *auxout_fname;
|
||||
FILE *auxout_fp;
|
||||
struct sockaddr_in sin;
|
||||
int n;
|
||||
char *cname;
|
||||
char *pname;
|
||||
|
@ -161,21 +159,10 @@ main(int ac, char **av)
|
|||
port = getenv("EMPIREPORT");
|
||||
if (!port)
|
||||
port = empireport;
|
||||
if (!hostport(port, &sin)) {
|
||||
fprintf(stderr, "Can't resolve Empire port %s\n", port);
|
||||
exit(1);
|
||||
}
|
||||
host = getenv("EMPIREHOST");
|
||||
if (!host)
|
||||
host = empirehost;
|
||||
if (!hostaddr(host, &sin)) {
|
||||
fprintf(stderr, "Can't resolve Empire host %s\n", host);
|
||||
exit(1);
|
||||
}
|
||||
if ((sock = hostconnect(&sin)) < 0) {
|
||||
perror("Can't connect to Empire server");
|
||||
exit(1);
|
||||
}
|
||||
sock = tcp_connect(host, port);
|
||||
cname = getenv("COUNTRY");
|
||||
if (ac > 1)
|
||||
cname = argv[1];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue