#include <poll.h>
#include <fcntl.h>
#include <stdlib.h>
+#include <stdbool.h>
#include <errno.h>
+#include "sockets.h"
#ifdef HAVE_IO_H
#include <io.h>
+#define pipe(x) _pipe(x, 256, O_BINARY)
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#include <sys/wait.h>
#endif
-enum { FALSE, TRUE };
-
#ifndef SO_REUSEPORT
#define SO_REUSEPORT SO_REUSEADDR
#endif
memset (&ia, 0, sizeof (ia));
ia.sin_family = AF_INET;
- inet_aton ("127.0.0.1", &ia.sin_addr);
+ inet_pton (AF_INET, "127.0.0.1", &ia.sin_addr);
ia.sin_port = htons (TEST_PORT);
if (bind (s, (struct sockaddr *) &ia, sizeof (ia)) < 0)
{
memset (&ia, 0, sizeof (ia));
ia.sin_family = AF_INET;
- inet_aton ("127.0.0.1", &ia.sin_addr);
+ inet_pton (AF_INET, "127.0.0.1", &ia.sin_addr);
ia.sin_port = htons (TEST_PORT);
if (!blocking)
{
#ifdef __MSVCRT__
unsigned long iMode = 1;
- ioctl (s, FIONBIO, &iMode);
+ ioctlsocket (s, FIONBIO, (void *) &iMode);
#elif defined F_GETFL
int oldflags = fcntl (s, F_GETFL, NULL);
if (poll1_nowait (s, POLLIN | POLLRDNORM | POLLRDBAND) != 0)
failed ("can read, socket not connected");
- c1 = connect_to_socket (FALSE);
+ c1 = connect_to_socket (false);
if (poll1_wait (s, POLLIN | POLLRDNORM | POLLRDBAND) != (POLLIN | POLLRDNORM))
failed ("expecting POLLIN | POLLRDNORM on passive socket");
else
{
close (s);
- c = connect_to_socket (TRUE);
+ c = connect_to_socket (true);
if (poll1_nowait (c, POLLOUT | POLLWRNORM | POLLRDBAND)
!= (POLLOUT | POLLWRNORM))
failed ("cannot write after blocking connect");
socklen_t addrlen = sizeof (ia);
int s = open_server_socket ();
- int c1 = connect_to_socket (FALSE);
+ int c1 = connect_to_socket (false);
int c2 = accept (s, (struct sockaddr *) &ia, &addrlen);
close (s);
{
int result;
+ gl_sockets_startup (SOCKETS_2_0);
+
#ifdef INTERACTIVE
printf ("Please press Enter\n");
test (test_tty, "TTY");