/* create an endpoint for communication The socket function creates a socket that is bound to a specific transport service provider. This function is called by the application layer to obtain a socket handle. 
socket */
INT16 CC3000_EXPORT() socket(INT32 domain, INT32 type, INT32 protocol)
/* create an endpoint for communication The socket function creates a socket that is bound to a specific transport service provider. This function is called by the application layer to obtain a socket handle. 
socket */
INT16 CC3000_EXPORT() socket(INT32 domain, INT32 type, INT32 protocol)
{
	INT32 ret;
	UINT8 *ptr, *args;
	ret = EFAIL;
	ptr = tSLInformation.pucTxCommandBuffer;
	args = (ptr + HEADERS_SIZE_CMD);
	args = UINT32_TO_STREAM(args, domain);
	args = UINT32_TO_STREAM(args, type);
	args = UINT32_TO_STREAM(args, protocol);
	hci_command_send(HCI_CMND_SOCKET, ptr, SOCKET_OPEN_PARAMS_LEN);
	SimpleLinkWaitEvent(HCI_CMND_SOCKET, &ret);
	CC3000_EXPORT(errno) = ret;
	set_socket_active_status(ret, SOCKET_STATUS_ACTIVE);
	return(ret);
}