HP OpenVMS Systems

ask the wizard
Content starts here

TCP/IP Services and setsockopt?

» close window

The Question is:

 
I am running VMS6.2 with TCP/IP services for open VMS version 3.2.  I am trying
 to use the setsockopt to alter the use of bind, listen, accept sequence to
 allow the program to continue past the accept command if no connection request
 are present.  The pro
gram hangs on the accept.
 
/*
 * set the server options
 */
 
        timeout.tv_sec  = msecs / 1000;
        timeout.tv_usec = (msecs % 1000) * 1000;
        status_lv_l = setsockopt
          (server_socket_lv_l,
           SOL_SOCKET,
           UCX$C_TCP_PROBE_IDLE,
           &timeout,
           sizeof timeout);
        if (status_lv_l == -1)
        {
                printf ("** Error while setsockopt %d **\n",status_lv_l );
                printf ("** Error number %d **\n",errno);
                return -1;
        }
/*
 * Bind name to Server Socket
 */
        retval = bind ( server_socket_lv_l, (struct sockaddr*)&server_socket_lv_
r, sizeof server_socket_lv_r );
        if (retval)
        {
                return -4;
        }
/*
 * Listen on socket 2 for connections.
 */
        retval = listen (server_socket_lv_l, 5);
        if (retval)
        {
                return -5;
        }
/*                                                                            */
        return server_socket_lv_l;
 
/*
 *
 */
int tcp_utl_accept(void)
 
/*
 *      Accept connection from client
 *      accepted connection will be on client_socket_lv_l.
 */
        printf("Waiting for Connection Request from Client...\n");
/*                                                                            */
        namelength = sizeof (server_socket_lv_r);
        status_lv_l = accept(server_socket_lv_l,
          (struct sockaddr*)&server_socket_lv_r, &namelength);
        if (status_lv_l == -1)
        {
                return -1;
        }
        else
        {
                client_socket_lv_l = status_lv_l;
                return client_socket_lv_l;
        }
 }


The Answer is :

 
  Please use a more current and supported release of TCP/IP Services, and
  please apply the ECO for the particular release in use.
 
  TCP/IP Services V3.2 is more than two major product releases behind, and
  V4.2 (with ECO) is the recommended minimum for use on OpenVMS VAX V6.2.
 

answer written or last revised on ( 26-JUL-2004 )

» close window