SimpleLink API Reference Manual  1.11.1
 All Data Structures Files Functions Variables Typedefs Macros Groups
Socket_api

Data Structures

struct  _in_addr_t
 
struct  _sockaddr_t
 
struct  _sockaddr_in_t
 
struct  fd_set
 

Macros

#define HOSTNAME_MAX_LENGTH   (230)
 
#define AF_INET   2
 
#define AF_INET6   23
 
#define SOCK_STREAM   1
 
#define SOCK_DGRAM   2
 
#define SOCK_RAW   3
 
#define SOCK_RDM   4
 
#define SOCK_SEQPACKET   5
 
#define IPPROTO_IP   0
 
#define IPPROTO_ICMP   1
 
#define IPPROTO_IPV4   IPPROTO_IP
 
#define IPPROTO_TCP   6
 
#define IPPROTO_UDP   17
 
#define IPPROTO_IPV6   41
 
#define IPPROTO_NONE   59
 
#define IPPROTO_RAW   255
 
#define IPPROTO_MAX   256
 
#define SOC_ERROR   (-1)
 
#define SOC_IN_PROGRESS   (-2)
 
#define SOL_SOCKET   0xffff
 
#define SOCKOPT_RECV_NONBLOCK   0
 
#define SOCKOPT_RECV_TIMEOUT   1
 
#define SOCKOPT_ACCEPT_NONBLOCK   2
 
#define SOCK_ON   0
 
#define SOCK_OFF   1
 
#define MAX_PACKET_SIZE   1500
 
#define MAX_LISTEN_QUEUE   4
 
#define IOCTL_SOCKET_EVENTMASK
 
#define ENOBUFS   55
 
#define __FD_SETSIZE   32
 
#define ASIC_ADDR_LEN   8
 
#define NO_QUERY_RECIVED   -3
 
#define __NFDBITS   (8 * sizeof (__fd_mask))
 
#define __FDELT(d)   ((d) / __NFDBITS)
 
#define __FDMASK(d)   ((__fd_mask) 1 << ((d) % __NFDBITS))
 
#define __FD_ZERO(set)
 
#define __FD_SET(d, set)   (__FDS_BITS (set)[__FDELT (d)] |= __FDMASK (d))
 
#define __FD_CLR(d, set)   (__FDS_BITS (set)[__FDELT (d)] &= ~__FDMASK (d))
 
#define __FD_ISSET(d, set)   (__FDS_BITS (set)[__FDELT (d)] & __FDMASK (d))
 
#define FD_SET(fd, fdsetp)   __FD_SET (fd, fdsetp)
 
#define FD_CLR(fd, fdsetp)   __FD_CLR (fd, fdsetp)
 
#define FD_ISSET(fd, fdsetp)   __FD_ISSET (fd, fdsetp)
 
#define FD_ZERO(fdsetp)   __FD_ZERO (fdsetp)
 
#define htonl(A)
 
#define ntohl   htonl
 
#define htons(A)
 
#define ntohs   htons
 
#define SET_mDNS_ADD(sockaddr)
 

Typedefs

typedef struct _in_addr_t in_addr
 
typedef struct _sockaddr_t sockaddr
 
typedef struct _sockaddr_in_t sockaddr_in
 
typedef unsigned long socklen_t
 
typedef long int __fd_mask
 

Functions

int socket (long domain, long type, long 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.
 
long closesocket (long sd)
 The socket function closes a created socket.
 
long accept (long sd, sockaddr *addr, socklen_t *addrlen)
 accept a connection on a socket: This function is used with connection-based socket types (SOCK_STREAM). It extracts the first connection request on the queue of pending connections, creates a new connected socket, and returns a new file descriptor referring to that socket. The newly created socket is not in the listening state. The original socket sd is unaffected by this call. The argument sd is a socket that has been created with socket(), bound to a local address with bind(), and is listening for connections after a listen(). The argument addr is a pointer to a sockaddr structure. This structure is filled in with the address of the peer socket, as known to the communications layer. The exact format of the address returned addr is determined by the socket's address family. The addrlen argument is a value-result argument: it should initially contain the size of the structure pointed to by addr, on return it will contain the actual length (in bytes) of the address returned.
 
long bind (long sd, const sockaddr *addr, long 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.
 
long listen (long sd, long backlog)
 listen for connections on a socket The willingness to accept incoming connections and a queue limit for incoming connections are specified with listen(), and then the connections are accepted with accept. The listen() call applies only to sockets of type SOCK_STREAM The backlog parameter defines the maximum length the queue of pending connections may grow to.
 
int gethostbyname (char *hostname, unsigned short usNameLen, unsigned long *out_ip_addr)
 Get host IP by name. Obtain the IP Address of machine on network, by its name.
 
long connect (long sd, const sockaddr *addr, long addrlen)
 initiate a connection on a socket Function connects the socket referred to by the socket descriptor sd, to the address specified by addr. The addrlen argument specifies the size of addr. The format of the address in addr is determined by the address space of the socket. If it is of type SOCK_DGRAM, this call specifies the peer with which the socket is to be associated; this address is that to which datagrams are to be sent, and the only address from which datagrams are to be received. If the socket is of type SOCK_STREAM, this call attempts to make a connection to another socket. The other socket is specified by address, which is an address in the communications space of the socket. Note that the function implements only blocking behavior thus the caller will be waiting either for the connection establishment or for the connection establishment failure.
 
int select (long nfds, fd_set *readsds, fd_set *writesds, fd_set *exceptsds, struct timeval *timeout)
 Monitor socket activity Select allow a program to monitor multiple file descriptors, waiting until one or more of the file descriptors become "ready" for some class of I/O operation.
 
int setsockopt (long sd, long level, long optname, const void *optval, socklen_t optlen)
 set socket options This function manipulate the options associated with a socket. Options may exist at multiple protocol levels; they are always present at the uppermost socket level. When manipulating socket options the level at which the option resides and the name of the option must be specified. To manipulate options at the socket level, level is specified as SOL_SOCKET. To manipulate options at any other level the protocol number of the appropriate protocol controlling the option is supplied. For example, to indicate that an option is to be interpreted by the TCP protocol, level should be set to the protocol number of TCP; The parameters optval and optlen are used to access optval - use for setsockopt(). For getsockopt() they identify a buffer in which the value for the requested option(s) are to be returned. For getsockopt(), optlen is a value-result parameter, initially containing the size of the buffer pointed to by option_value, and modified on return to indicate the actual size of the value returned. If no option value is to be supplied or returned, option_value may be NULL.
 
int getsockopt (long sd, long level, long optname, void *optval, socklen_t *optlen)
 set socket options This function manipulate the options associated with a socket. Options may exist at multiple protocol levels; they are always present at the uppermost socket level. When manipulating socket options the level at which the option resides and the name of the option must be specified. To manipulate options at the socket level, level is specified as SOL_SOCKET. To manipulate options at any other level the protocol number of the appropriate protocol controlling the option is supplied. For example, to indicate that an option is to be interpreted by the TCP protocol, level should be set to the protocol number of TCP; The parameters optval and optlen are used to access optval - use for setsockopt(). For getsockopt() they identify a buffer in which the value for the requested option(s) are to be returned. For getsockopt(), optlen is a value-result parameter, initially containing the size of the buffer pointed to by option_value, and modified on return to indicate the actual size of the value returned. If no option value is to be supplied or returned, option_value may be NULL.
 
int recv (long sd, void *buf, long len, long flags)
 function receives a message from a connection-mode socket
 
int recvfrom (long sd, void *buf, long len, long flags, sockaddr *from, socklen_t *fromlen)
 read data from socket function receives a message from a connection-mode or connectionless-mode socket. Note that raw sockets are not supported.
 
int send (long sd, const void *buf, long len, long flags)
 Write data to TCP socket This function is used to transmit a message to another socket.
 
int sendto (long sd, const void *buf, long len, long flags, const sockaddr *to, socklen_t tolen)
 Write data to TCP socket This function is used to transmit a message to another socket.
 
int mdnsAdvertiser (unsigned short mdnsEnabled, char *deviceServiceName, unsigned short deviceServiceNameLength)
 Set CC3000 in mDNS advertiser mode in order to advertise itself.
 

Detailed Description

Macro Definition Documentation

#define HOSTNAME_MAX_LENGTH   (230)

Definition at line 57 of file socket.h.

#define AF_INET   2

Definition at line 61 of file socket.h.

#define AF_INET6   23

Definition at line 62 of file socket.h.

#define SOCK_STREAM   1

Definition at line 66 of file socket.h.

#define SOCK_DGRAM   2

Definition at line 67 of file socket.h.

#define SOCK_RAW   3

Definition at line 68 of file socket.h.

#define SOCK_RDM   4

Definition at line 69 of file socket.h.

#define SOCK_SEQPACKET   5

Definition at line 70 of file socket.h.

#define IPPROTO_IP   0

Definition at line 74 of file socket.h.

#define IPPROTO_ICMP   1

Definition at line 75 of file socket.h.

#define IPPROTO_IPV4   IPPROTO_IP

Definition at line 76 of file socket.h.

#define IPPROTO_TCP   6

Definition at line 77 of file socket.h.

#define IPPROTO_UDP   17

Definition at line 78 of file socket.h.

#define IPPROTO_IPV6   41

Definition at line 79 of file socket.h.

#define IPPROTO_NONE   59

Definition at line 80 of file socket.h.

#define IPPROTO_RAW   255

Definition at line 81 of file socket.h.

#define IPPROTO_MAX   256

Definition at line 82 of file socket.h.

#define SOC_ERROR   (-1)

Definition at line 86 of file socket.h.

#define SOC_IN_PROGRESS   (-2)

Definition at line 87 of file socket.h.

#define SOL_SOCKET   0xffff

Definition at line 90 of file socket.h.

#define SOCKOPT_RECV_NONBLOCK   0

Definition at line 91 of file socket.h.

#define SOCKOPT_RECV_TIMEOUT   1

Definition at line 92 of file socket.h.

#define SOCKOPT_ACCEPT_NONBLOCK   2

Definition at line 93 of file socket.h.

#define SOCK_ON   0

Definition at line 94 of file socket.h.

#define SOCK_OFF   1

Definition at line 95 of file socket.h.

#define MAX_PACKET_SIZE   1500

Definition at line 97 of file socket.h.

#define MAX_LISTEN_QUEUE   4

Definition at line 98 of file socket.h.

#define IOCTL_SOCKET_EVENTMASK

Definition at line 100 of file socket.h.

#define ENOBUFS   55

Definition at line 102 of file socket.h.

#define __FD_SETSIZE   32

Definition at line 104 of file socket.h.

#define ASIC_ADDR_LEN   8

Definition at line 106 of file socket.h.

#define NO_QUERY_RECIVED   -3

Definition at line 108 of file socket.h.

#define __NFDBITS   (8 * sizeof (__fd_mask))

Definition at line 136 of file socket.h.

#define __FDELT (   d)    ((d) / __NFDBITS)

Definition at line 137 of file socket.h.

#define __FDMASK (   d)    ((__fd_mask) 1 << ((d) % __NFDBITS))

Definition at line 138 of file socket.h.

#define __FD_ZERO (   set)
Value:
do { \
unsigned int __i; \
fd_set *__arr = (set); \
for (__i = 0; __i < sizeof (fd_set) / sizeof (__fd_mask); ++__i) \
__FDS_BITS (__arr)[__i] = 0; \
} while (0)

Definition at line 149 of file socket.h.

#define __FD_SET (   d,
  set 
)    (__FDS_BITS (set)[__FDELT (d)] |= __FDMASK (d))

Definition at line 156 of file socket.h.

#define __FD_CLR (   d,
  set 
)    (__FDS_BITS (set)[__FDELT (d)] &= ~__FDMASK (d))

Definition at line 157 of file socket.h.

#define __FD_ISSET (   d,
  set 
)    (__FDS_BITS (set)[__FDELT (d)] & __FDMASK (d))

Definition at line 158 of file socket.h.

#define FD_SET (   fd,
  fdsetp 
)    __FD_SET (fd, fdsetp)

Definition at line 161 of file socket.h.

#define FD_CLR (   fd,
  fdsetp 
)    __FD_CLR (fd, fdsetp)

Definition at line 162 of file socket.h.

#define FD_ISSET (   fd,
  fdsetp 
)    __FD_ISSET (fd, fdsetp)

Definition at line 163 of file socket.h.

#define FD_ZERO (   fdsetp)    __FD_ZERO (fdsetp)

Definition at line 164 of file socket.h.

#define htonl (   A)
Value:
((((unsigned long)(A) & 0xff000000) >> 24) | \
(((unsigned long)(A) & 0x00ff0000) >> 8) | \
(((unsigned long)(A) & 0x0000ff00) << 8) | \
(((unsigned long)(A) & 0x000000ff) << 24))

Definition at line 168 of file socket.h.

#define ntohl   htonl

Definition at line 173 of file socket.h.

#define htons (   A)
Value:
((((unsigned long)(A) & 0xff00) >> 8) | \
(((unsigned long)(A) & 0x00ff) << 8))

Definition at line 176 of file socket.h.

#define ntohs   htons

Definition at line 180 of file socket.h.

#define SET_mDNS_ADD (   sockaddr)
Value:
sockaddr.sa_data[0] = 0x14; \
sockaddr.sa_data[1] = 0xe9; \
sockaddr.sa_data[2] = 0xe0; \
sockaddr.sa_data[3] = 0x0; \
sockaddr.sa_data[4] = 0x0; \
sockaddr.sa_data[5] = 0xfb;

Definition at line 183 of file socket.h.

Typedef Documentation

typedef struct _in_addr_t in_addr
typedef struct _sockaddr_t sockaddr
typedef struct _sockaddr_in_t sockaddr_in
typedef unsigned long socklen_t

Definition at line 130 of file socket.h.

typedef long int __fd_mask

Definition at line 133 of file socket.h.

Function Documentation

int socket ( long  domain,
long  type,
long  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

Parameters
domainselects the protocol family which will be used for communication. On this version only AF_INET is supported
typespecifies the communication semantics. On this version only SOCK_STREAM, SOCK_DGRAM, SOCK_RAW are supported
protocolspecifies a particular protocol to be used with the socket IPPROTO_TCP, IPPROTO_UDP or IPPROTO_RAW are supported.
Returns
On success, socket handle that is used for consequent socket operations. On error, -1 is returned.
long closesocket ( long  sd)

The socket function closes a created socket.

closesocket

Parameters
sdsocket handle.
Returns
On success, zero is returned. On error, -1 is returned.
long accept ( long  sd,
sockaddr addr,
socklen_t addrlen 
)

accept a connection on a socket: This function is used with connection-based socket types (SOCK_STREAM). It extracts the first connection request on the queue of pending connections, creates a new connected socket, and returns a new file descriptor referring to that socket. The newly created socket is not in the listening state. The original socket sd is unaffected by this call. The argument sd is a socket that has been created with socket(), bound to a local address with bind(), and is listening for connections after a listen(). The argument addr is a pointer to a sockaddr structure. This structure is filled in with the address of the peer socket, as known to the communications layer. The exact format of the address returned addr is determined by the socket's address family. The addrlen argument is a value-result argument: it should initially contain the size of the structure pointed to by addr, on return it will contain the actual length (in bytes) of the address returned.

accept

Parameters
[in]sdsocket descriptor (handle)
[out]addrthe argument addr is a pointer to a sockaddr structure This structure is filled in with the address of the peer socket, as known to the communications layer. determined. The exact format of the address returned addr is by the socket's address sockaddr. On this version only AF_INET is supported. This argument returns in network order.
[out]addrlenthe addrlen argument is a value-result argument: it should initially contain the size of the structure pointed to by addr.
Returns
For socket in blocking mode: On success, socket handle. on failure negative For socket in non-blocking mode:
  • On connection establishment, socket handle
  • On connection pending, SOC_IN_PROGRESS (-2)
  • On failure, SOC_ERROR (-1)
See Also
socket ; bind ; listen
long bind ( long  sd,
const sockaddr addr,
long  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

Parameters
[in]sdsocket descriptor (handle)
[out]addrspecifies the destination address. On this version only AF_INET is supported.
[out]addrlencontains the size of the structure pointed to by addr.
Returns
On success, zero is returned. On error, -1 is returned.
See Also
socket ; accept ; listen
long listen ( long  sd,
long  backlog 
)

listen for connections on a socket The willingness to accept incoming connections and a queue limit for incoming connections are specified with listen(), and then the connections are accepted with accept. The listen() call applies only to sockets of type SOCK_STREAM The backlog parameter defines the maximum length the queue of pending connections may grow to.

listen

Parameters
[in]sdsocket descriptor (handle)
[in]backlogspecifies the listen queue depth. On this version backlog is not supported.
Returns
On success, zero is returned. On error, -1 is returned.
See Also
socket ; accept ; bind
Note
On this version, backlog is not supported
int gethostbyname ( char *  hostname,
unsigned short  usNameLen,
unsigned long *  out_ip_addr 
)

Get host IP by name. Obtain the IP Address of machine on network, by its name.

gethostbyname

Parameters
[in]hostnamehost name
[in]usNameLenname length
[out]out_ip_addrThis parameter is filled in with host IP address. In case that host name is not resolved, out_ip_addr is zero.
Returns
On success, positive is returned. On error, negative is returned
Note
On this version, only blocking mode is supported. Also note that the function requires DNS server to be configured prior to its usage.
long connect ( long  sd,
const sockaddr addr,
long  addrlen 
)

initiate a connection on a socket Function connects the socket referred to by the socket descriptor sd, to the address specified by addr. The addrlen argument specifies the size of addr. The format of the address in addr is determined by the address space of the socket. If it is of type SOCK_DGRAM, this call specifies the peer with which the socket is to be associated; this address is that to which datagrams are to be sent, and the only address from which datagrams are to be received. If the socket is of type SOCK_STREAM, this call attempts to make a connection to another socket. The other socket is specified by address, which is an address in the communications space of the socket. Note that the function implements only blocking behavior thus the caller will be waiting either for the connection establishment or for the connection establishment failure.

connect

Parameters
[in]sdsocket descriptor (handle)
[in]addrspecifies the destination addr. On this version only AF_INET is supported.
[out]addrlencontains the size of the structure pointed to by addr
Returns
On success, zero is returned. On error, -1 is returned
See Also
socket
int select ( long  nfds,
fd_set readsds,
fd_set writesds,
fd_set exceptsds,
struct timeval timeout 
)

Monitor socket activity Select allow a program to monitor multiple file descriptors, waiting until one or more of the file descriptors become "ready" for some class of I/O operation.

select

Parameters
[in]nfdsthe highest-numbered file descriptor in any of the three sets, plus 1.
[out]writesdssocket descriptors list for write monitoring
[out]readsdssocket descriptors list for read monitoring
[out]exceptsdssocket descriptors list for exception monitoring
[in]timeoutis an upper bound on the amount of time elapsed before select() returns. Null means infinity timeout. The minimum timeout is 5 milliseconds, less than 5 milliseconds will be set automatically to 5 milliseconds.
Returns
On success, select() returns the number of file descriptors contained in the three returned descriptor sets (that is, the total number of bits that are set in readfds, writefds, exceptfds) which may be zero if the timeout expires before anything interesting happens. On error, -1 is returned. *readsds - return the sockets on which Read request will return without delay with valid data. *writesds - return the sockets on which Write request will return without delay. *exceptsds - return the sockets which closed recently.

If the timeout value set to less than 5ms it will automatically set to 5ms to prevent overload of the system

See Also
socket
int setsockopt ( long  sd,
long  level,
long  optname,
const void *  optval,
socklen_t  optlen 
)

set socket options This function manipulate the options associated with a socket. Options may exist at multiple protocol levels; they are always present at the uppermost socket level. When manipulating socket options the level at which the option resides and the name of the option must be specified. To manipulate options at the socket level, level is specified as SOL_SOCKET. To manipulate options at any other level the protocol number of the appropriate protocol controlling the option is supplied. For example, to indicate that an option is to be interpreted by the TCP protocol, level should be set to the protocol number of TCP; The parameters optval and optlen are used to access optval - use for setsockopt(). For getsockopt() they identify a buffer in which the value for the requested option(s) are to be returned. For getsockopt(), optlen is a value-result parameter, initially containing the size of the buffer pointed to by option_value, and modified on return to indicate the actual size of the value returned. If no option value is to be supplied or returned, option_value may be NULL.

setsockopt

Parameters
[in]sdsocket handle
[in]leveldefines the protocol level for this option
[in]optnamedefines the option name to Interrogate
[in]optvalspecifies a value for the option
[in]optlenspecifies the length of the option value
Returns
On success, zero is returned. On error, -1 is returned

On this version the following two socket options are enabled: The only protocol level supported in this version is SOL_SOCKET (level).

  1. SOCKOPT_RECV_TIMEOUT (optname) SOCKOPT_RECV_TIMEOUT configures recv and recvfrom timeout in milliseconds. In that case optval should be pointer to unsigned long.
  2. SOCKOPT_NONBLOCK (optname). sets the socket non-blocking mode on or off. In that case optval should be SOCK_ON or SOCK_OFF (optval).
See Also
getsockopt
int getsockopt ( long  sd,
long  level,
long  optname,
void *  optval,
socklen_t optlen 
)

set socket options This function manipulate the options associated with a socket. Options may exist at multiple protocol levels; they are always present at the uppermost socket level. When manipulating socket options the level at which the option resides and the name of the option must be specified. To manipulate options at the socket level, level is specified as SOL_SOCKET. To manipulate options at any other level the protocol number of the appropriate protocol controlling the option is supplied. For example, to indicate that an option is to be interpreted by the TCP protocol, level should be set to the protocol number of TCP; The parameters optval and optlen are used to access optval - use for setsockopt(). For getsockopt() they identify a buffer in which the value for the requested option(s) are to be returned. For getsockopt(), optlen is a value-result parameter, initially containing the size of the buffer pointed to by option_value, and modified on return to indicate the actual size of the value returned. If no option value is to be supplied or returned, option_value may be NULL.

getsockopt

Parameters
[in]sdsocket handle
[in]leveldefines the protocol level for this option
[in]optnamedefines the option name to Interrogate
[out]optvalspecifies a value for the option
[out]optlenspecifies the length of the option value
Returns
On success, zero is returned. On error, -1 is returned

On this version the following two socket options are enabled: The only protocol level supported in this version is SOL_SOCKET (level).

  1. SOCKOPT_RECV_TIMEOUT (optname) SOCKOPT_RECV_TIMEOUT configures recv and recvfrom timeout in milliseconds. In that case optval should be pointer to unsigned long.
  2. SOCKOPT_NONBLOCK (optname). sets the socket non-blocking mode on or off. In that case optval should be SOCK_ON or SOCK_OFF (optval).
See Also
setsockopt
int recv ( long  sd,
void *  buf,
long  len,
long  flags 
)

function receives a message from a connection-mode socket

recv

Parameters
[in]sdsocket handle
[out]bufPoints to the buffer where the message should be stored
[in]lenSpecifies the length in bytes of the buffer pointed to by the buffer argument.
[in]flagsSpecifies the type of message reception. On this version, this parameter is not supported.
Returns
Return the number of bytes received, or -1 if an error occurred
See Also
recvfrom

On this version, only blocking mode is supported.

int recvfrom ( long  sd,
void *  buf,
long  len,
long  flags,
sockaddr from,
socklen_t fromlen 
)

read data from socket function receives a message from a connection-mode or connectionless-mode socket. Note that raw sockets are not supported.

recvfrom

Parameters
[in]sdsocket handle
[out]bufPoints to the buffer where the message should be stored
[in]lenSpecifies the length in bytes of the buffer pointed to by the buffer argument.
[in]flagsSpecifies the type of message reception. On this version, this parameter is not supported.
[in]frompointer to an address structure indicating the source address: sockaddr. On this version only AF_INET is supported.
[in]fromlensource address structure size
Returns
Return the number of bytes received, or -1 if an error occurred
See Also
recv

On this version, only blocking mode is supported.

int send ( long  sd,
const void *  buf,
long  len,
long  flags 
)

Write data to TCP socket This function is used to transmit a message to another socket.

send

Parameters
sdsocket handle
bufPoints to a buffer containing the message to be sent
lenmessage size in bytes
flagsOn this version, this parameter is not supported
Returns
Return the number of bytes transmitted, or -1 if an error occurred

On this version, only blocking mode is supported.

See Also
sendto
int sendto ( long  sd,
const void *  buf,
long  len,
long  flags,
const sockaddr to,
socklen_t  tolen 
)

Write data to TCP socket This function is used to transmit a message to another socket.

sendto

Parameters
sdsocket handle
bufPoints to a buffer containing the message to be sent
lenmessage size in bytes
flagsOn this version, this parameter is not supported
topointer to an address structure indicating the destination address: sockaddr. On this version only AF_INET is supported.
tolendestination address structure size
Returns
Return the number of bytes transmitted, or -1 if an error occurred

On this version, only blocking mode is supported.

See Also
send
int mdnsAdvertiser ( unsigned short  mdnsEnabled,
char *  deviceServiceName,
unsigned short  deviceServiceNameLength 
)

Set CC3000 in mDNS advertiser mode in order to advertise itself.

mdnsAdvertiser

Parameters
[in]mdnsEnabledflag to enable/disable the mDNS feature
[in]deviceServiceNameService name as part of the published canonical domain name
[in]deviceServiceNameLengthLength of the service name
Returns
On success, zero is returned, return SOC_ERROR if socket was not opened successfully, or if an error occurred.