/* assign a name to a socket This function gives the socket the local address addr. addr is addrlen bytes long. Traditionally, this is called when a socket is created with socket, it exists in a name space (address family) but has no name assigned. It is necessary to assign a local address before a SOCK_STREAM socket may receive connections. 
bind */
INT32 CC3000_EXPORT() bind(INT32 sd, const sockaddr *addr, INT32 addrlen)
/* assign a name to a socket This function gives the socket the local address addr. addr is addrlen bytes long. Traditionally, this is called when a socket is created with socket, it exists in a name space (address family) but has no name assigned. It is necessary to assign a local address before a SOCK_STREAM socket may receive connections. 
bind */
INT32 CC3000_EXPORT() bind(INT32 sd, const sockaddr *addr, INT32 addrlen)
{
	INT32 ret;
	UINT8 *ptr, *args;
	ret = EFAIL;
	ptr = tSLInformation.pucTxCommandBuffer;
	args = (ptr + HEADERS_SIZE_CMD);
	addrlen = ASIC_ADDR_LEN;
	args = UINT32_TO_STREAM(args, sd);
	args = UINT32_TO_STREAM(args, 0x00000008);
	args = UINT32_TO_STREAM(args, addrlen);
	ARRAY_TO_STREAM(args, ((UINT8 *)addr), addrlen);
	hci_command_send(HCI_CMND_BIND,
		ptr, SOCKET_BIND_PARAMS_LEN);
	SimpleLinkWaitEvent(HCI_CMND_BIND, &ret);
	CC3000_EXPORT(errno) = ret;
	return(ret);
}