HP3000-L Archives

June 1997, Week 1

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Steve Dirickson b894 WestWin <[log in to unmask]>
Reply To:
Steve Dirickson b894 WestWin <[log in to unmask]>
Date:
Thu, 5 Jun 1997 20:01:00 P
Content-Type:
text/plain
Parts/Attachments:
text/plain (91 lines)
<<We have developed a socket listener in Cobol on the HP3000 as part of
our web solution for a client.

We used a sockets library that has been "wrapped" for easy use from Cobol
(I can't remember who on this list originally gave me this), but one
thing we would really like is the ability to do non-blocking io on the
socket. Failing this, we would like to set up a timer which would
interrupt the read after a certain timeout period.

Would IPC Intrinsics give us this, and if so, where are they documented
for the HP3000?>>


Yes; "NetIPC 3000/XL Programmer's Reference Manual, 36920-61005.

<<How about RPC's? Are they available for the HP3000?>>


Only if you buy the "DCE/3000" add-on product.

<<All help would be greatly appreciated.>>


Non-blocking I/O (called "NOWAIT" in 3000-land) works like a champ with
NetIPC sockets. Here's what I use (in C; sorry, no speakum COBOL):

/* Function: int RecvBlockNoWait(SOCKET Socket, char *buf, int maxlen,
int recvflags)

 Purpose: Same as RecvBlock(), except return immediately if no
   data is available.

 Return Value: The number of bytes received (which will be 0 if no
received
   data was pending), or SOCKET_ERROR if an error occurs.

 Side Effects: If successful, 'buf' contains the raw data received. If an
   error occurs, the contents of 'buf' are indeterminate.
   On an error, the global variable errno_IPC is set to the
   IPCRECV error code.
*/
int RecvBlockNoWait(SOCKET Socket, char *buf, int maxlen, int recvflags)
 {
 int dlen = maxlen;
 short rlen = 0;
 int flags = recvflags;
 int res32 = 0;

 IPCCONTROL(Socket, 1,,,,,, &res32); /* enable NOWAIT */
 if (res32)
  {
  printf("IPCCONTROL(1) error: %d\n", res32);
  fflush(stdout);
  errno_IPC = res32;
  return SOCKET_ERROR;
  }
 IPCRECV(Socket, buf, &dlen, &flags,, &res32);
 if (res32)
  {
  printf("Waited IPCRECV error: %d\n", res32);
  fflush(stdout);
  errno_IPC = res32;
  return SOCKET_ERROR;
  }
 else if (IODONTWAIT(Socket, buf, &rlen)) /* try to complete the receive
*/
  {
  dlen = rlen;
  }
 else      /* nothing waiting - abort NOWAIT receive */
  {
  IPCCONTROL(Socket, 258,,,,,, &res32);
  if (res32)
   {
   printf("IPCCONTROL(258) error: %d\n", res32);
   fflush(stdout);
   }
  dlen = 0;
  }
 IPCCONTROL(Socket, 2,,,,,, &res32); /* disable NOWAIT */
 if (res32)
  {
  printf("IPCCONTROL(2) error: %d\n", res32);
  fflush(stdout);
  }
 return dlen;
 }

Steve Dirickson         WestWin Consulting
(360) 598-6111  [log in to unmask]

ATOM RSS1 RSS2