1 ?RCS: $Id: sockopt.U,v 3.0.1.1 1995/07/25 14:16:14 ram Exp $
3 ?RCS: Copyright (c) 1991-1993, Raphael Manfredi
5 ?RCS: You may redistribute only under the terms of the Artistic Licence,
6 ?RCS: as specified in the README file that comes with the distribution.
7 ?RCS: You may reuse parts of this distribution only within the terms of
8 ?RCS: that same Artistic Licence; a copy of which may be found at the root
9 ?RCS: of the source tree for dist 3.0.
11 ?RCS: $Log: sockopt.U,v $
12 ?RCS: Revision 3.0.1.1 1995/07/25 14:16:14 ram
13 ?RCS: patch56: obsoleted KEEPALIVE in favor of CAN_KEEPALIVE for consistency
15 ?RCS: Revision 3.0 1993/08/18 12:09:48 ram
16 ?RCS: Baseline for dist 3.0 netwide release.
18 ?MAKE:d_keepalive: cat rm contains +cc +ccflags +ldflags socketlib sockethdr \
19 d_oldsock libs Oldconfig Setvar Findhdr
20 ?MAKE: -pick add $@ %<
22 ?S: This symbol conditionally defines CAN_KEEPALIVE which indicates to the C
23 ?S: program that setsockopt SO_KEEPALIVE will work properly.
25 ?C:CAN_KEEPALIVE (KEEPALIVE):
26 ?C: This symbol if defined indicates to the C program that the SO_KEEPALIVE
27 ?C: option of setsockopt() will work as advertised in the manual.
29 ?H:#$d_keepalive CAN_KEEPALIVE /**/
32 : see if setsockopt with SO_KEEPALIVE works as advertised
36 if $contains SO_KEEPALIVE `./findhdr sys/socket.h` \
37 /dev/null >/dev/null 2>&1
39 echo "OK, let's see if SO_KEEPALIVE works as advertised..." >&4
41 #include <sys/types.h>
42 #include <sys/socket.h>
43 #include <netinet/in.h>
48 int s = socket(AF_INET, SOCK_STREAM, 0);
51 if (-1 == setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, 0, 0))
56 if $cc $ccflags $sockethdr $ldflags -o socket socket.c $libs \
57 $socketlib >/dev/null 2>&1; then
58 ./socket >/dev/null 2>&1
60 0) echo "Yes, it does!"
63 (Something went wrong -- Assuming SO_KEEPALIVE is broken)
66 2) echo "No, it doesn't. Don't trust your manuals!!"
71 (I can't compile the test program -- Assuming SO_KEEPALIVE is broken)
76 echo "Strange!! You have BSD 4.2 sockets but no SO_KEEPALIVE option."
80 As you have an old socket interface, you can't have heard of SO_KEEPALIVE.
86 $rm -f socket socket.c