HP OpenVMS Systems

ask the wizard
Content starts here

TCP/IP socket recv failure?

» close window

The Question is:

 
Hi there,
 
We have developed an OpenVMS application that uses
TCP/IP sockets.  In-house we've tested it with
UCX and VMS v6.2.  We have now tested (at customers
site) with v7.1 and MultiNet, with no problems.
However, if we then go onto v7.1 with UCX we have
a problem with the recv function.  it returns a
failed error code.  The code segments are below.
 
As you can see in our main we are initialising a
socket which may of come from a service startup.
 
  iRc = SocketServerInit( HostName, &iPortNum, &hBindSocket, &hSocket,
&lReason );
 
  if (iRc != OK)
    appWriteErrorMsg(hErrorLog, "Error - MQFeeder:", "SocketServerInit
FAILED" , &lReason);
  else
  {
    iRc = SocketRecv(hSocket, (char *)&sRecvBuf, sizeof(sRecvBuf),
&iBufLen);
  }
 
The code for SocketServerInit is as follows...
 
long SocketServerInit(char *HostName, int * iPort, SOCKET * hSocket, SOCKET
* hSocket2, long *lReason )
 
  struct sockaddr_in    ServerAddr;
  struct sockaddr_in    ClientAddr;
  int                   iLimit    = 5;
  unsigned int          iRetLen;
  int                   iRc = OK;
  struct servent      * stService;
  int                   iError;
 
  memset(&ServerAddr, 0, sizeof(ServerAddr));
 
  *hSocket = socket(AF_INET,SOCK_STREAM,0);
    return FAIL;
 
  if (*iPort == 0)
  {
    *hSocket2 = socket(UCX$C_AUXS, 0, 0);;
    return OK;
  }
  else
  {
    if (*iPort <= 0 )
      *iPort = DEFAULT_PORT_NUMBER;
 
    ServerAddr.sin_port = htons(*iPort) ;
  };
 
  ServerAddr.sin_family      = AF_INET     ;
  ServerAddr.sin_addr.s_addr = INADDR_ANY  ;
 
  iRc = bind(*hSocket,(struct sockaddr*)&ServerAddr,sizeof(ServerAddr));
 
  iError = errno;
  if (iRc != OK)
  {
    perror("SocketServerInit: Bind");
    return iRc;
  };
 
  listen(*hSocket,iLimit);
 
  iRetLen = sizeof(ServerAddr);
  *hSocket2 =accept(*hSocket ,(struct sockaddr*)&ClientAddr, &iRetLen);
 
  return OK;
 
 
 
Then the SocketRecv function is....
 
long SocketRecv (SOCKET hSocketId, char * sRecvBuf, int iBufLen, int
*iBufRecvd)
 
  if ((*iBufRecvd=recv(hSocketId,sRecvBuf,iBufLen,0))<=0)
	  return FAIL;
 
  return OK;
 
 
The SocketServerInit is getting a socket, but as
soon as a receive is done, the function fails.
Is there some obvious patch?  or pehaps a slight
oversight that would make this fail?  or maybe
even some configuration within UCX that needs
performing?
 
Thanks
 


The Answer is :

 
  The TCP/IP Services package version is separate from the OpenVMS
  version.  TCP/IP Services V4.2 and V5.0 are the expected releases
  found on OpenVMS V7.1.  To determine the version, use one of the
  following commands:
 
    $ tcpip show version
    $ ucx show version
 
  There are ECO kits available for V4.2 and prior releases, and an ECO
  for V5.0 (the current version) is expected.  Please install the current
  ECO for the TCP/IP Services package, and try your test again.
 
  If the current ECO does not resolve the problem, please contact the
  Compaq Customer Support Center.  If a formal report is required, a
  complete standalone example of the failure will make locating and
  resolving the problem much quicker.
 

answer written or last revised on ( 10-MAY-1999 )

» close window