]>
git.cameronkatri.com Git - bsdgames-darwin.git/blob - hunt/huntd/ctl.c
1 /* $NetBSD: ctl.c,v 1.2 1997/10/10 16:32:54 lukem Exp $ */
3 * Copyright (c) 1983 Regents of the University of California.
4 * All rights reserved. The Berkeley software License Agreement
5 * specifies the terms and conditions for redistribution.
10 #if defined(TALK_43) || defined(TALK_42)
12 #include <sys/cdefs.h>
15 static char sccsid
[] = "@(#)ctl.c 5.2 (Berkeley) 3/13/86";
17 __RCSID("$NetBSD: ctl.c,v 1.2 1997/10/10 16:32:54 lukem Exp $");
22 * This file handles haggling with the various talk daemons to
23 * get a socket to talk to. sockt is opened and connected in
30 struct sockaddr_in daemon_addr
= { AF_INET
};
31 struct sockaddr_in ctl_addr
= { AF_INET
};
33 /* inet addresses of the two machines */
34 struct in_addr my_machine_addr
;
35 struct in_addr his_machine_addr
;
37 u_short daemon_port
; /* port number of the talk daemon */
43 /* open the ctl socket */
49 ctl_addr
.sin_port
= 0;
50 ctl_addr
.sin_addr
= my_machine_addr
;
51 ctl_sockt
= socket(AF_INET
, SOCK_DGRAM
, 0);
53 p_error("Bad socket");
54 if (bind(ctl_sockt
, (struct sockaddr
*)&ctl_addr
, sizeof(ctl_addr
)) != 0)
55 p_error("Couldn't bind to control socket");
56 length
= sizeof(ctl_addr
);
57 if (getsockname(ctl_sockt
, (struct sockaddr
*) &ctl_addr
, &length
) < 0)
58 p_error("Bad address for ctl socket");