Accepts the first queued connection by assigning it to the new socket.
| Item | Description | 
|---|---|
| so | The socket that is used in the kern_solisten() Kernel Service. | 
| aso | The new socket for the accepted connection. The caller must pass in the address of the ksocket_t. | 
| name | A struct sockadr address is returned in a mbuf buffer whose address is stored in the *name parameter. The caller should pass in the address of the struct mbuf * structure. The caller sets the mbuf buffer free after the function returns successfully. | 
| nonblock | A flag to specify if this call should be nonblocking. The value of 1 is for nonblocking and 0 is for blocking. | 
The kern_soaccept kernel service accepts the first queued connection by assigning it to the new socket.
The kern_soaccept kernel service can be called from the process environment.
struct mbuf *name = NULL;
ksocket_t   so;
ksocket_t   aso;
struct sockaddr_in laddr;
int		     rc;		
rc = kern_socreate(AF_INET, &so, SOCK_STREAM, IPPROTO_TCP);
if (rc != 0 )  		 
{ 		 		 
      return(-1); 		 
}		   		 
bzero(&laddr, sizeof(struct sockaddr_in)); 		 
laddr.sin_family = AF_INET; 		 
laddr.sin_port = 12345; 		 
laddr.sin_len = sizeof(struct sockaddr_in); 		 
laddr.sin_addr.s_addr = inet_addr("9.3.108.208"); 		 
rc = kern_sobind(so, (struct sockaddr *)&laddr); 		
if (rc != 0 )  		 
{ 		 		 
     return(-1); 		 
}		   		 
rc = kern_solisten(so, 5); 		 
if (rc != 0 )  		 
{ 		 		 
     return(-1); 		 
}		   		 
rc = kern_soaccept(so, &aso, &name, 0); 		 
if (rc != 0 )  		 
{ 		 		 
     return(-1); 		  		 
}		  		 
m_freem(name); /* Caller needs to free the mbuf after kern_soaccept */| Item | Description | 
|---|---|
| 0 | Upon Success | 
| >0 | Error | 
The non-zero return value is the error number that is defined in the /usr/include/sys/errno.h file.