SECTION 10
Host Application Program
10-16 6950 Enterprise Gateway Server User’s Guide
/*
** startup sockets
*/
#ifdef WIN32
x = WSAStartup (0x0101, &WsaData);
if(x==SOCKET_ERROR)
{
printf(”\nnui_sock: can’t init winsock interface
%d.”,errno);
fflush(stdout);
exit(1);
}
#endif
/*
* Open a TCP socket (an Internet stream socket).
*/
FD_ZERO(&main_fd_set);
if((listen_fd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
{
perror(”\nnui_sock: can’t open local socket”);
exit(1);
}
/*
* Fill in the structure ”serv_addr” with the address of the
* server that we want to connect with.
*/
memset(&serv_addr,0x00,sizeof(serv_addr));
serv_addr.sin_family = AF_INET;
serv_addr.sin_addr.s_addr = htonl(INADDR_ANY);
serv_addr.sin_port = htons(ipport);
if (bind(listen_fd, (struct sockaddr *) &serv_addr,
sizeof(serv_addr)) < 0)
{
perror(”\nnui_sock: can’t bind to local socket”);
exit(1);
}
listen(listen_fd, 5);
/*
** add this fd to our work list so we know when clients connect
*/
FD_SET(listen_fd, &main_fd_set);
Содержание 6950
Страница 1: ...6950 Enterprise Gateway Server USER S GUIDE PN 961 047 091 Revision D September 1999 ...
Страница 38: ...SECTION 3 Installation 3 22 6950 Enterprise Gateway Server User s Guide ...
Страница 44: ...SECTION 4 Connecting to the 6950 EGS 4 6 6950 Enterprise Gateway Server User s Guide ...
Страница 74: ...SECTION 5 Configuring Network Options 5 30 6950 Enterprise Gateway Server User s Guide ...
Страница 86: ...SECTION 6 Configuring Radio Frequency Communication 6 12 6950 Enterprise Gateway Server User s Guide ...
Страница 96: ...SECTION 7 Halting Rebooting or Restarting the 6950 EGS 7 10 6950 Enterprise Gateway Server User s Guide ...
Страница 138: ...SECTION 10 Host Application Program 10 24 6950 Enterprise Gateway Server User s Guide ...
Страница 144: ...INDEX Index 6 6950 Enterprise Gateway Server User s Guide ...