| * Copyright (C) 2008-2009 by Darren Reed. |
| * See the IPFILTER.LICENCE file for details on licencing. |
| * Format expected is one addres per line, at the start of each line. |
| connecttcp(char *server, int port) |
| memset(&sin, 0, sizeof(sin)); |
| sin.sin_family = AF_INET; |
| sin.sin_port = htons(port & 65535); |
| if (inet_aton(server, &sin.sin_addr) == -1) { |
| host = gethostbyname(server); |
| memcpy(&sin.sin_addr, host->h_addr_list[0], |
| fd = socket(AF_INET, SOCK_STREAM, 0); |
| if (connect(fd, (struct sockaddr *)&sin, sizeof(sin)) == -1) { |