|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T c
Length: 1925 (0x785)
Types: TextFile
Names: »connections.c«
└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
└─⟦0c25cb74a⟧ »DATA«
└─⟦038380b96⟧
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
└─⟦f494b5154⟧ »DATA«
└─⟦038380b96⟧
└─⟦this⟧ »connections.c«
└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
└─⟦0c25cb74a⟧ »DATA«
└─⟦0732ea0cf⟧
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
└─⟦f494b5154⟧ »DATA«
└─⟦0732ea0cf⟧
└─⟦this⟧ »../../dtia/release_apollo_2.1/connections.c«
└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
└─⟦0c25cb74a⟧ »DATA«
└─⟦25fab149a⟧
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
└─⟦f494b5154⟧ »DATA«
└─⟦25fab149a⟧
└─⟦this⟧ »../../dtia/release_sun_2.1/connections.c«
└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
└─⟦0c25cb74a⟧ »DATA«
└─⟦be254d495⟧
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
└─⟦f494b5154⟧ »DATA«
└─⟦be254d495⟧
└─⟦this⟧ »../../dtia/release_aix_2.1/connections.c«
└─⟦8ee07855d⟧ Bits:30000545 8mm tape, Rational 1000, DTIA 2_1_6
└─⟦0c25cb74a⟧ »DATA«
└─⟦c67979795⟧
└─⟦d0624311f⟧ Bits:30000529 8mm tape, Rational 1000, DTIA 2_1_7
└─⟦f494b5154⟧ »DATA«
└─⟦c67979795⟧
└─⟦this⟧ »../../dtia/release_hp_2.1/connections.c«
#ifndef lint
#ifndef DEBUG
static char SCCS_id[] = "@(#)connections.c 2.1 90/08/02 19:05:13 Copyright(c) 1990 by Rational.";
#else
static char SCCS_id[] = "@(#)connections.c DEBUG 2.1 90/08/02 19:05:13 Copyright(c) 1990 by Rational.";
#endif
#endif
#include "dtia_server.h"
static char host_name[MAXHOSTNAMELEN];
static struct hostent *host;
static struct sockaddr_in sock_addr;
static u_short port_number;
static int sock_fd;
static int addr_type=0;
int ok_port(p)
int p;
{
port_number = p;
return (port_number>IPPORT_RESERVED) ;
}
int init_connections() {
if ((gethostname(host_name,MAXHOSTNAMELEN)) ||
(!(host = gethostbyname(host_name)))) {
perror("Host name");
return -1;
}
addr_type = host->h_addrtype;
if ((sock_fd = socket(addr_type,SOCK_STREAM,0)) == -1) {
perror("Socket");
return -1;
}
bzero((char *)&sock_addr,sizeof(sock_addr));
sock_addr.sin_family = addr_type;
sock_addr.sin_port = port_number;
bcopy(host->h_addr,(char *)&sock_addr.sin_addr,host->h_length);
if (bind(sock_fd,(struct sockaddr *)&sock_addr,
sizeof(sock_addr)) == -1) {
perror("Bind");
return -1;
}
if (listen(sock_fd,5) == -1) {
perror("Listen");
return -1;
}
return 0;
}
int wait_for_connection(timeout)
struct timeval *timeout;
{
int ret_select;
fd_set r;
FD_ZERO(&r);
FD_SET(sock_fd,&r);
while ((ret_select=select(getdtablesize(),
&r, (fd_set *)NULL, (fd_set *)NULL,
(nb_sons()==0)?NULL:timeout))==-1) {
if (errno==EINTR) continue;
else break;
}
return ret_select;
}
int get_connection() {
int addrlen;
int fd;
bzero((char *)&sock_addr,sizeof(sock_addr));
sock_addr.sin_family = addr_type;
sock_addr.sin_port = port_number;
bcopy(host->h_addr,(char *)&sock_addr.sin_addr,host->h_length);
addrlen=sizeof(sock_addr);
fd = accept(sock_fd,(struct sockaddr *)&sock_addr,&addrlen);
if (fd == -1) {
perror("Accept");
}
return fd;
}