|
|
1.1 root 1: /*
2: * Copyright (c) 1983 Regents of the University of California.
3: * All rights reserved. The Berkeley software License Agreement
4: * specifies the terms and conditions for redistribution.
5: */
6:
7: #include "bsd.h"
8:
9: #if defined(TALK_43) || defined(TALK_42)
10:
11: #ifndef lint
12: static char sccsid[] = "@(#)ctl.c 5.2 (Berkeley) 3/13/86";
13: #endif not lint
14:
15: /*
16: * This file handles haggling with the various talk daemons to
17: * get a socket to talk to. sockt is opened and connected in
18: * the progress
19: */
20:
21: #include "talk_ctl.h"
22:
23: struct sockaddr_in daemon_addr = { AF_INET };
24: struct sockaddr_in ctl_addr = { AF_INET };
25:
26: /* inet addresses of the two machines */
27: struct in_addr my_machine_addr;
28: struct in_addr his_machine_addr;
29:
30: u_short daemon_port; /* port number of the talk daemon */
31:
32: int ctl_sockt;
33:
34: CTL_MSG msg;
35:
36: /* open the ctl socket */
37: open_ctl()
38: {
39: int length;
40:
41: ctl_addr.sin_port = 0;
42: ctl_addr.sin_addr = my_machine_addr;
43: ctl_sockt = socket(AF_INET, SOCK_DGRAM, 0);
44: if (ctl_sockt <= 0)
45: p_error("Bad socket");
46: if (bind(ctl_sockt, &ctl_addr, sizeof(ctl_addr)) != 0)
47: p_error("Couldn't bind to control socket");
48: length = sizeof(ctl_addr);
49: if (getsockname(ctl_sockt, (struct sockaddr *) &ctl_addr, &length) < 0)
50: p_error("Bad address for ctl socket");
51: }
52: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.