Hi'
I have a problem with TCP/IP keep-alive messages under Digital UNIX
3.2g and I wondered if anybody knows of any errors and/or problems
with these.
I have a very small test program (seen below) that simply creates a
socket, sets the SO_KEEPALIVE option and connnect to another machine
(named balder) on our local network. But when I try to run this
program (effectively as 'sock balder telnet') I get the following
output from tcpdump:
tma_at_modi$ tcpdump 'host balder and port telnet'
tcpdump: listening on tu0
Using kernel BPF filter
11:20:51.705648 modi.2537 > balder.telnet: S 1121408000:1121408000(0) win 32768 <mss 1460,nop,wscale 0>
11:20:51.706624 balder.telnet > modi.2537: S 1409261036:1409261036(0) ack 1121408001 win 8760 <mss 1460> (DF)
11:20:51.706624 modi.2537 > balder.telnet: . ack 1 win 33580
11:20:51.784704 balder.telnet > modi.2537: P 1:16(15) ack 1 win 8760 (DF)
11:20:51.963888 modi.2537 > balder.telnet: . ack 16 win 33565
No keep-alive messages are seen for 1000 seconds. So my questions are:
are there any problems with SO_KEEPALIVE under Digital UNIX 3.2g? Is
it implemented at all?
/tonny
------------------------------------------------------------
#include <assert.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h> // Socket stuff
#include <arpa/inet.h> // inet_ntoa and friends
int
main(int argc, char *argv[])
{
int fd;
int ret;
int sock_opt;
sockaddr_in ipaddr;
assert(argc >= 3);
fd = socket(AF_INET, SOCK_STREAM, 0);
assert(fd >= 0);
sock_opt = 1;
ret = setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (caddr_t)&sock_opt, sizeof(sock_opt));
assert(ret >= 0);
ipaddr.sin_family = AF_INET;
ipaddr.sin_addr.s_addr = inet_addr(argv[1]);
ipaddr.sin_port = htons(atoi(argv[2]));
ret = connect(fd, (sockaddr*)&ipaddr, sizeof(ipaddr));
assert(ret >= 0);
sleep(1000);
}
------------------------------------------------------------
Received on Mon Sep 15 1997 - 12:00:35 NZST