SECTION 10
Host Application Program
10-18 6950 Enterprise Gateway Server User’s Guide
/*
** use the select to see if anything is waiting
*/
for(;;)
{
if (shut_down)
{
break; /* user requested shutdown, so goodbye */
}
memcpy((void *)&read_fd_set, (void *)&main_fd_set,
sizeof(fd_set));
seltime.tv_usec = 0;
seltime.tv_sec = 15; /* 15 second timeout */
gotdata=select(FD_SETSIZE,&read_fd_set,0,0,&seltime);
if(gotdata > 0)
{
/*
** it is a new connection, connect it
*/
if(FD_ISSET(listen_fd,&read_fd_set))
{
clilen = sizeof(cli_addr);
sockfd = accept(listen_fd,(struct sockaddr
*)&cli_addr,&clilen);
if(sockfd < 0)
{
printf(”\nnui_sock: Accept error. Port=%d
(%d)”,ipport,errno);
fflush(stdout);
}
ip=inet_ntoa(cli_addr.sin_addr);
host_rec=gethostbyaddr((char *)
&cli_addr.sin_addr,4,AF_INET);
strcpy(host,host_rec–>h_name);
printf(”\nnui_sock: HEARD <%s:%s>”,host,ip);
fflush(stdout);
FD_CLR(listen_fd,&read_fd_set);
add_fd(sockfd,host,ip); /* add the connection to
our fd list */
Summary of Contents for 6950
Page 1: ...6950 Enterprise Gateway Server USER S GUIDE PN 961 047 091 Revision D September 1999 ...
Page 38: ...SECTION 3 Installation 3 22 6950 Enterprise Gateway Server User s Guide ...
Page 44: ...SECTION 4 Connecting to the 6950 EGS 4 6 6950 Enterprise Gateway Server User s Guide ...
Page 74: ...SECTION 5 Configuring Network Options 5 30 6950 Enterprise Gateway Server User s Guide ...
Page 138: ...SECTION 10 Host Application Program 10 24 6950 Enterprise Gateway Server User s Guide ...
Page 144: ...INDEX Index 6 6950 Enterprise Gateway Server User s Guide ...