TCP/IP Programming Manual

NOTE: HP recommends that you use the Common Run-Time Environment (CRE) when developing
TAL socket applications. CRE is described in the CRE Programming Manual.
If your application is incompatible with CRE, use the CRE-Independent socket library described in
“Socket Libraries” at the beginning of this section.
Native Mode C/C++ Issues
Users of the native mode C/C++ compiler (nmc) need to specify the extensions compiler pragma
for correct compilation of the socket library header files. The extensions pragma also needs to
be specified when the c89 compiler is used for systype=guardian compiles.
accept
The accept function checks for connections on an existing waited socket. When a connection
request arrives, accept creates a new socket to use for data transfer and accepts the connection
on the new socket.
C Synopsis
#include <socket.h>
#include <in.h>
#include <in6.h> /* if using IPv6 */
#include <netdb.h>
new_socket = accept (socket, from_ptr, from_len_ptr);
int new_socket, socket;
struct sockaddr *from_ptr;
int *from_len_ptr;
TAL Synopsis
?NOLIST, SOURCE SOCKDEFT
?NOLIST, SOURCE SOCKPROC
new_socket := accept (socket, from_ptr, from_len_ptr);
INT(32) new_socket;
INT(32) socket;
INT .EXT from_ptr (sockaddr_in),
.EXT from_len_ptr;
new_socket
return value; the socket number for the new, connected socket that is created for data transfer.
If the call is not successful, –1 is returned and the external variable errno is set as indicated
below in Errors (page 90).
socket
input value; specifies the socket number, created by a previous socket call, to be used to
check for connections.
from_ptr
input and return value; points, on return, to the remote address and port number for the new
connection.
from_len_ptr
input and return value; points, initially, to a value indicating the size in bytes of the structure
pointed to by from_ptr. On return, it points to the actual length in bytes of the remote address
and port number, or sockaddr data structure, pointed to by from_ptr.
Native Mode C/C++ Issues 89