Sockets.

The JCC socket interface uses the assembler EZA system functions to perform its work. The source code to the JCC sockets library code is supplied with FTP as it has been in previous releases, and is not described in detail in this document. The latest release of the TCPIP library components within JCC include support for any modern OS as well as the old library.

All the testing performed on the JCC sockets library was done in a modified Hercules emulator using a special TCP/IP instruction.

WARNING: when using sockets, INITAPI and TERMAPI are automatically executed when needed to ensure proper system operation. This requires any worker threads (which also use sockets) to be properly terminated with syncthread before final program termination - to ensure TCPIP system resources are released.

Here is a list of macro's which have been implemented:

ntohl(x)
ntohs(x)
htonl(x)
htons(x)
NTOHL(x)
NTOHS(x)
HTONL(x)
HTONS(x)
FD_SET(n, p)
FD_CLR(n, p)
FD_ISSET(n, p)
FD_COPY(f, t)
FD_ZERO(p)
Here is a list of functions which have been implemented:

/* These functions are available on all platforms */

long socket       (long af, long type, long protocol);
long bind         (long socket, struct sockaddr * name, long namelen);
long connect      (long socket, struct sockaddr * name, long namelen);
long listen       (long socket, long backlog);
long accept       (long socket, struct sockaddr * name, long * pnamelen);
long send         (long socket, char * buffer, long length, long flags);
long recv         (long socket, char * buffer, long length, long flags);
long select       (long socket, void * readfds, void * writefds, void * exceptfds, void * timeout);
long ioctlsocket  (long socket, long command, long * pargument);
long closesocket  (long socket);

unsigned long inet_addr (const char *);
int           inet_aton (const char *, struct in_addr *);

/* These functions are available on newer machines */

long fcntl        (long ss, int command, int reqarg);
long gethostid    ();
long gethostname  (int namelen, char * name);
long getpeername  (long socket, struct sockaddr * name);
long getsockname  (long socket, struct sockaddr * name, int * pnamelen);
long getsockopt   (int optname, int * optval, int optlen);
long ioctl        (long socket, int command, int reqarg, int * retarg);
long readsocket   (long socket, void * buf, int nbyte);
long readv        (long socket, void * iov, int iovcnt);
long recvfrom     (long socket, void * buf, int nbyte, int flags, struct sockaddr * name);
long recvmsg      (long socket, char * msg, int flags);
long sendmsg      (long socket, char * msg, int flags);
long sendto       (long socket, void * buf, int nbyte, int flags, struct sockaddr * name);
long setsockopt   (long socket, int optname, int * optval, int optlen);
long shutdown     (long socket, int how);
long writesocket  (long socket, void * buf, int nbyte);
long writev       (long socket, void * iov, int iovcnt);
long getclientid  (struct clientid * client);
long givesocket   (long socket, struct clientid * client);
long takesocket   (struct clientid * client, long socrecv);
long selectex     (long maxsoc, fd_set * r, fd_set * w, fd_set * e, void * t, void * selecb);
long getibmopt    (int command, void * buf);

struct hostent * gethostbyname (char * name);
struct hostent * gethostbyaddr (struct hostaddr * ha);

/* These functions are made available by JCC for general use */

long ascii2ebcdic (char * buffer, long length);
long ebcdic2ascii (char * buffer, long length);

long WSAGetLastError ();
long HercGetLastError ();
The ioctlsocket function supports FIONBIO and FIONREAD commands.