HP OpenVMS Systems

ask the wizard
Content starts here

File descriptors and C socket programming?

» close window

The Question is:

 
This program was executed under OpenVms 6.2 UCX 4.0 and Cxx 5.0 Utilized these
 macros:
 
  #define fd_set int
  #define FD_SET(x,y) (*y = *y | (1<<x))
  #define FD_CLR(x,y) (*y = *y & ~(1<<x))
  #define FD_ISSET(x,y) (*y & (1<<x))
  #define FD_ZERO(y) (*y = 0)
...
      fd_set aux_mascara;
      fd_set cero;
 
      FD_ZERO(&cero);
 
bcopy (&mascara,&aux_mascara, sizeof(mascara));
if(select(32,&aux_mascara,&cero,&cero, NULL)< 0){
         perror ("main/Select");
         continue;
 
 
AND now that has brought up to date to OpenVMS 7.2-1 compilador Cxx 6.2 TCPIP
 V5.0A I have the following message:
 
main/Select: socket operation on non-socket
main/Select: socket operation on non-socket
 
 That this passing? The macros already they come defined with the present one
 compilador, they are incompatible?, as it I solve?
 That modifications exist for the funcion select ()?
 
Thanks
 
 
 


The Answer is :

 
  Apparently at least one of the file descriptors in the specified file
  descriptor (fd) set is not associated with a socket.  There was a change
  made (in recent OpenVMS releases and recent OpenVMS CRTL ECO kits) to
  how the select() function handles situations where the file descriptor
  is not associated with a socket.
 
  Attached below are the associated release notes.  (Using the logical
  name specified below, you can obtain the older behaviour.)
 
  o  The select() function has been corrected to return failure
     status if either invalid file descriptor or file descriptor
     not associated with a socket is found in one of the specified
     file descriptor sets.  In case of invalid file descriptor, the
     select() function sets errno to EBADF.  In case of a file
     descriptor not associated with a socket, the function sets
     errno to ENOTSOCK.
 
     Failure with errno set to EBADF is the standard requirement
     for the select() function.  Failure with errno set to ENOTSOCK
     is because currently the select() function can operate only on
     sockets.
 
     Prior to this fix, the function was setting errno as described
     above, but otherwise was ignoring invalid file descriptors and
     file descriptors not associated with sockets.
 
     The old behavior can be requested by defining the logical name
     DECC$SELECT_IGNORES_INVALID_FD prior to invoking the application
     (any equivalence string).
 

answer written or last revised on ( 19-SEP-2001 )

» close window