/*
* Copyright (C) 1998-2001, 2004, 2007, 2008, 2012-2017 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* $Id: sock_test.c,v 1.55 2008/07/23 23:27:54 marka Exp $ */
#include <config.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
static void
}
static void
printf("my_send: %s task %p\n\t(sock %p, base %p, length %d, n %d, "
"result %d)\n",
}
}
static void
printf("Socket %s (sock %p, base %p, length %d, n %d, result %d)\n",
} else {
}
return;
}
/*
* Echo the data back.
*/
} else
} else {
printf("\r\nReceived: %.*s\r\n\r\n",
}
}
static void
printf("my_http_get: %s task %p\n\t(sock %p, base %p, length %d, "
"n %d, result %d)\n",
return;
}
}
static void
return;
}
/*
* Send a GET string, and set up to receive (and just display)
* the result.
*/
"GET / HTTP/1.1\r\nHost: www.flame.org\r\n"
"Connection: Close\r\n\r\n");
} else {
}
}
static void
printf("newcon %s (task %p, oldsock %p, newsock %p, result %d)\n",
/*
* Queue another listen on this socket.
*/
== ISC_R_SUCCESS);
/*
* Create a new task for this socket, and queue up a
* recv on it.
*/
== ISC_R_SUCCESS);
} else {
return;
}
}
static void
}
int
unsigned int workers;
int pf;
if (argc > 1) {
if (workers < 1)
workers = 1;
if (workers > 8192)
workers = 8192;
} else
workers = 2;
if (isc_net_probeipv6() == ISC_R_SUCCESS)
else
/*
* EVERYTHING needs a memory context.
*/
/*
* The task manager is independent (other than memory context)
*/
/*
* Timer manager depends only on the memory context as well.
*/
/*
* Open up a listener socket.
*/
in6a = in6addr_any;
} else {
}
&so1) == ISC_R_SUCCESS);
/*
* Queue up the first accept event.
*/
== ISC_R_SUCCESS);
/*
* Open up a socket that will connect to www.flame.org, port 80.
* Why not. :)
*/
else
&so2) == ISC_R_SUCCESS);
/*
* Detaching these is safe, since the socket will attach to the
* task for any outstanding requests.
*/
/*
* Wait a short while.
*/
#ifndef WIN32
sleep(10);
#else
Sleep(10000);
#endif
return (0);
}