Enumerations | |
enum | P_SOCKET_OPTIONS { , SOCKET_BOUND = 0x01, SOCKET_AUTOACK = 0x02, SOCKET_RECV_ALL = 0x04, SOCKET_FRAG = 0x08 , SOCKET_BROADCAST = 0x10, SOCKET_BLOCKING = 0x20, SOCKET_FILTER_DUPS = 0x40 } |
enum | P_FRAG_FLAG_MASKS { FRAG_STATEFLAG = 0x03, FRAG_ROLEFLAG = 0x04 } |
enum | P_FRAG_STATUS { FRAG_ACTIVE = 0x00, FRAG_FINISHED = 0x01, FRAG_ABORTED = 0x02 } |
enum | P_FRAG_ROLE { FRAG_SENDER = 0x00, FRAG_RECEIVER = 0x04 } |
enum | P_SOCKET_SENDSTATUS { P_SEND_FINISHED = 1, P_SEND_ACTIVE = 2, P_SEND_ABORTED = 3 } |
Functions | |
int | p_socket_open (uint32_t localip, uint32_t broadcast_add, int port) |
Create a particle socket. | |
int | p_socket_close (int sock) |
Close a particle socket. | |
int | p_socket_set_lastacks (int counter) |
Set the number of packets, which should be stored to find doublets of acking-packets. | |
int | p_socket_set_lastdups (int counter) |
Set the number of packets, which should be stored to find doublets. | |
int | p_socket_set_ipdest (int sock, const struct in_addr *address) |
Set the destination-add for a socket. | |
int | p_socket_set_ipdest_str (int sock, const char *address) |
Set the destination-add for a socket [string]. | |
int | p_socket_set_ipdest_all (int fd) |
Set the destination-add for a socket [string]. | |
int | p_socket_set_ipsrc_all (int sock) |
Set a Socket to receive all-mode. | |
int | p_socket_set_ipsrc (int sock, const struct in_addr *address) |
Set the source-add for a socket. | |
int | p_socket_set_ipsrc_str (int sock, const char *address) |
Set the source-add for a socket [string]. | |
int | p_socket_set_id (int sock, const uint8_t *add) |
Sets a particle sockets own net ID. | |
int | p_socket_set_id_str (int sock, const char *addstr) |
Sets a particle sockets own net ID. | |
int | p_socket_set_loc (int sock, const uint8_t *loc) |
Sets a particle sockets location-ID. | |
int | p_socket_set_loc_str (int sock, const char *locstr) |
Sets a particle sockets location-ID. | |
int | p_socket_set_option (int fd, int option, int mode) |
Sets a socket-option. | |
int | p_socket_set_retry (int sock, uint8_t retries, uint32_t timeout) |
Sets the parameters for acknowledged sending. | |
void | p_describe_socket (int sock) |
Prints out all information about a socket. | |
int | p_socket_get_lastacks (void) |
Get the number of packets, which should be stored to find doublets of acking packets. | |
uint8_t * | p_socket_get_id (int fd) |
Get the net ID of a socket. | |
uint8_t * | p_socket_get_loc (int fd) |
Get the location-ID of a socket. | |
uint8_t * | p_socket_get_ipdest (int fd, int device_number) |
Get an IP-address, the socket sends to. | |
int | p_socket_get_num_interfaces (int fd) |
Get the number of interfaces the socket sends to. | |
int | p_socket_set_num_interfaces (int fd, int counter) |
Sets the number of interfaces, a socket will send to. | |
uint8_t * | p_socket_get_ipsrc (int fd) |
Get the IP-address the socket receives from. | |
int | p_socket_get_retry (int fd) |
Get the number of retrys, the socket currently makes when sending acked. | |
uint32_t | p_socket_get_timeout (int fd) |
Get the timeout [ms], the socket currently waits for acknowledges. | |
uint16_t | p_socket_get_port (int fd) |
Get the port-number of a socket. | |
int | p_socket_get_option (int fd, int option) |
Tests, if a socket-option is set to 0 or 1. | |
int | p_socket_get_blocking (int fd) |
Is a socket currently blocking? | |
int | p_socket_get_broadcast (int fd) |
Is a socket currently sending to broadcast? | |
uint8_t | p_socket_get_last_seq (int fd) |
Get the last sequence-ID of a socket. | |
p_packet * | p_socket_recv (int recv_sock, int send_sock) |
Receive data. | |
p_packet * | p_socket_recv_filtered (int recv_sock, int send_sock, int recv_filter) |
Receive data filtered. | |
int | p_socket_recv_raw (int sock, char *data, size_t maxlen) |
Receive raw data. | |
int | p_socket_send (int send_sock, struct p_packet *send_data) |
Send data. Send CL-packet send_data on socket send_sock. | |
int | p_socket_send_addressed (int send_sock, struct p_packet *send_data, uint8_t *add) |
Send data to a particle specified by its ID. | |
int | p_socket_send_addressed_str (int send_sock, struct p_packet *send_data, const char *add_str) |
Send data to a particle specified by its ID. | |
int | p_socket_send_acked (int send_sock, int recv_sock, struct p_packet *send_data, const uint8_t *add) |
Send data to a particle specified by its ID and wait for ACK control message. | |
int | p_socket_send_acked_str (int send_sock, int recv_sock, struct p_packet *send_data, const char *addstr) |
Send data to a particle specified by its ID and wait for ACK control message. | |
int | p_socket_send_buffer (int fd_out, int fd_in, const char *buf, uint32_t len, const uint8_t *sendto, const uint8_t *acl_type) |
Sending a data puffer to a particle. | |
int | p_socket_send_buffer_str (int fd_out, int fd_in, const char *buf, uint32_t len, const char *sendto, const char *acl_type) |
Sending a data puffer to a particle [ID and ACL as string]. | |
int | p_socket_send_file (int fd_out, int fd_in, const char *filename, const uint8_t *sendto, const uint8_t *acl_type) |
Sending data from a file to a particle. | |
int | p_socket_send_raw (int sock, const char *data, size_t len) |
Send raw data. | |
int | p_socket_get_send_status (int sendticket) |
Get the status for a send-ticket. | |
int | p_socket_delete_send_context (int sendticket) |
Deletes the context of a send-ticket. | |
int | p_socket_set_broadcast () |
int | p_socket_set_blocking () |
int | p_socket_set_autoack () |
int | p_socket_set_recv_option () |
int | p_socket_set_frag_option () |
enum P_FRAG_FLAG_MASKS |
fragmentation status return masks
Definition at line 90 of file socket_enum.h.
enum P_FRAG_ROLE |
fragmentation role enumeration (status & FRAG_ROLEFLAG)
FRAG_SENDER | if fragmentation handler is sending |
FRAG_RECEIVER | if fragmentation handler is receiving |
Definition at line 110 of file socket_enum.h.
enum P_FRAG_STATUS |
fragmentation status enumeration (status & FRAG_STATEFLAG)
FRAG_ACTIVE | if fragmentation handler is still active |
FRAG_FINISHED | if fragmentation handler has finished successfully |
FRAG_ABORTED | if fragmentation handler failed |
Definition at line 99 of file socket_enum.h.
enum P_SOCKET_OPTIONS |
An enum for the socket options, you can change
Definition at line 53 of file socket_enum.h.
enum P_SOCKET_SENDSTATUS |
send status enumeration
P_SEND_FINISHED | if sending was successful |
P_SEND_ACTIVE | if still sending |
P_SEND_ABORTED | if sending failed |
Definition at line 119 of file socket_enum.h.
void p_describe_socket | ( | int | sock | ) |
Prints out all information about a socket.
Debug function, which prints out all internal information of socket sock to stdout.
sock | Particle socket |
int p_socket_close | ( | int | sock | ) |
Close a particle socket.
Closes an open UDP sockets and frees memory allocated for internal structures.
sock | Particle socket descriptor |
int p_socket_delete_send_context | ( | int | sendticket | ) |
Deletes the context of a send-ticket.
This function deletes all information about a send-context specified by the send-ticket.
sendticket | The ticket of the send-context you want to delete. |
int p_socket_get_blocking | ( | int | fd | ) |
Is a socket currently blocking?
fd | Pointer to the socket from which you want to get the blocking-mode. |
int p_socket_get_broadcast | ( | int | fd | ) |
Is a socket currently sending to broadcast?
fd | Pointer to the socket from which you want to get the sending-mode. |
uint8_t* p_socket_get_id | ( | int | fd | ) |
Get the net ID of a socket.
fd | Pointer to the socket from which you want to get the net ID |
uint8_t* p_socket_get_ipdest | ( | int | fd, | |
int | device_number | |||
) |
Get an IP-address, the socket sends to.
Gets the local broadcast address of the 1st / 2nd / 3rd / ... device, the socket sends to.
fd | Pointer to the socket from which you want to get the IP-destination. | |
device_number,: | Specifies the device, from that you want to get the address. |
uint8_t* p_socket_get_ipsrc | ( | int | fd | ) |
Get the IP-address the socket receives from.
fd | Pointer to the socket from which you want to get the IP-source. |
uint8_t p_socket_get_last_seq | ( | int | fd | ) |
Get the last sequence-ID of a socket.
Note: if you set the sequence number of the last packet with p_pkt_set_seq, p_socket_get_last_seq will not return you this special value!
fd | Pointer to the socket from which you want to get the port-number. |
int p_socket_get_lastacks | ( | void | ) |
Get the number of packets, which should be stored to find doublets of acking packets.
Get the number of acked packets, which should be hold in a queue an be compared with new received ack-packets to find doublets.
uint8_t* p_socket_get_loc | ( | int | fd | ) |
Get the location-ID of a socket.
fd | Pointer to the socket from which you want to get the location-ID |
int p_socket_get_num_interfaces | ( | int | fd | ) |
Get the number of interfaces the socket sends to.
fd | Pointer to the socket from which you want to get the number of interfaces. |
int p_socket_get_option | ( | int | fd, | |
int | option | |||
) |
Tests, if a socket-option is set to 0 or 1.
See p_socket_set_option for available options. In addition to the options listed there, you can also get the state of SOCKET_BOUND with p_socket_get_option
fd | Pointer to the socket from which you want to get the state of socket-option option. | |
option | The option, you want to look after. |
uint16_t p_socket_get_port | ( | int | fd | ) |
Get the port-number of a socket.
fd | Pointer to the socket from which you want to get the port-number. |
int p_socket_get_retry | ( | int | fd | ) |
Get the number of retrys, the socket currently makes when sending acked.
fd | Pointer to the socket from which you want to get the number of retries. |
int p_socket_get_send_status | ( | int | sendticket | ) |
Get the status for a send-ticket.
This function will return the current state for a packet that has been send with ticket sendticket
sendticket | The ticket of the packet you want the status for. |
uint32_t p_socket_get_timeout | ( | int | fd | ) |
Get the timeout [ms], the socket currently waits for acknowledges.
fd | Pointer to the socket from which you want to get the timeout. |
int p_socket_open | ( | uint32_t | localip, | |
uint32_t | broadcast_add, | |||
int | port | |||
) |
Create a particle socket.
This function creates a UDP socket.
If both localip and broadcast_add are 0, the socket_open function will call p_util_get_local_addresses to get all local IP-address and the according local broadcast-address. Libparticle will then send packets to all found network devices. If you set one specified address, libparticle will send packets only to this single network device.
The first time a receive- or send-function is called, the socket will be bound.
port | Port for sending or receiving. | |
localip | IP-address of the computer, which runs the libparticle. | |
broadcast_add | Broadcast-address of the local network. |
Default values for the socket options: SOCKET_BROADCAST -> On (1)
SOCKET_BLOCKING -> On (1)
SOCKET_RECV_ALL -> Off (0)
SOCKET_FRAG -> Off (0)
SOCKET_FILTER_DUPS -> Off (0)
SOCKET_AUTOACK -> Off (0)
struct p_packet* p_socket_recv | ( | int | recv_sock, | |
int | send_sock | |||
) |
Receive data.
Receive data from socket sock. Received data will be parsed to a CL-packet before it will be passed to the user. Acknowledges will be send automatically if autoack was set to 1.
recv_sock | Particle socket descriptor used for receiving | |
send_sock | Particle socket descriptor used for sending ACK packets... |
Throws exception EAGAIN if no data has been received (you can ignore this [in most cases] when receiving with a non-blocking socket) or if a received packet was addressed to an other particle-ID. Throws exception EILSEQ if libparticle could not parse received data into a CL-packet. Throws exception EILSEQ if the received packet was not for your particle-ID and you didn't set the option "receive all".
struct p_packet* p_socket_recv_filtered | ( | int | recv_sock, | |
int | send_sock, | |||
int | recv_filter | |||
) |
Receive data filtered.
Receive data from socket sock. Received data will be filtered with recv_filter.
recv_sock | Particle socket descriptor used for receiving | |
send_sock | Particle socket descriptor used for sending ACK packets... | |
recv_filter | Filter, with which the received data should be filtered |
Throws exception EAGAIN when a packet was received, but it did not match with the given filter or when no data was received.
int p_socket_recv_raw | ( | int | sock, | |
char * | data, | |||
size_t | maxlen | |||
) |
Receive raw data.
Receive raw data from socket sock.
sock | Particle socket descriptor | |
*data | Pointer to the data buffer where received data is stored | |
maxlen | Size of data buffer |
Throws exception ENOTCONN when sock is not bound and it was not possible to bind it.
int p_socket_send | ( | int | send_sock, | |
struct p_packet * | send_data | |||
) |
Send data. Send CL-packet send_data on socket send_sock.
send_sock | Particle socket descriptor | |
send_data | Pointer to a CL packet that should be send. |
int p_socket_send_acked | ( | int | send_sock, | |
int | recv_sock, | |||
struct p_packet * | send_data, | |||
const uint8_t * | add | |||
) |
Send data to a particle specified by its ID and wait for ACK control message.
Send data to a particle specified by its ID and wait for ACK control message. Resend packet if ACK is not received within timeout. The necessary control message ACL Types will be added automatically.
send_sock | Particle socket descriptor used for sending CL packets | |
recv_sock | Particle socket descriptor used for receiving ACK packets | |
send_data | Pointer to a CL packet that should be send. | |
add | Pointer to an array containing the receivers ID, can be NULL iff the packet already contains a CAD tuple. |
int p_socket_send_acked_str | ( | int | send_sock, | |
int | recv_sock, | |||
struct p_packet * | send_data, | |||
const char * | addstr | |||
) |
Send data to a particle specified by its ID and wait for ACK control message.
Send data to a particle specified by its ID and wait for ACK control message. Resend packet if ACK is not received within timeout. The necessary control message ACL Types will be added automatically.
send_sock | Particle socket descriptor used for sending CL packets | |
recv_sock | Particle socket descriptor used for receiving ACK packets | |
send_data | Pointer to a CL packet that should be send. | |
addstr | Dotted string containing the receivers ID can be NULL, iff the packet already contains a CAD tuple. |
int p_socket_send_addressed | ( | int | send_sock, | |
struct p_packet * | send_data, | |||
uint8_t * | add | |||
) |
Send data to a particle specified by its ID.
Send Data addressed to one particle, specified by its net ID. The necessary control message ACL Types will be added automatically.
If you send packets with large data (ACL-payload > 64 Byte, mayfrag must be set to 1 while adding the ACL-touple to the packet), p_socket_send_addressed will init an fragmented data transfer. That means, that the data for this packet will be send in more than one packets and will get re-assambled at the receiver. p_socket_send_addressed will send the first part of the data, and each time your program gets an ack from the receiver, it will send the next part until the complete data has been transfered.
Socket option SOCKET_FRAG msut be set to 1 at the sender as well as the receiver!
For sending the complete data, you need a program like this:
p_socket_set_option(sendsock, SOCKET_FRAG, 1); sendticket = p_socket_send_addressed(sendsock, packet, address); do { p_socket_recv(recvsock, sendsock); } while (p_socket_get_send_status(sendticket) == P_SEND_ACTIVE)
send_sock | Particle socket descriptor | |
send_data | Pointer to a CL packet that should be send. | |
add | Array containing the receivers ID |
int p_socket_send_addressed_str | ( | int | send_sock, | |
struct p_packet * | send_data, | |||
const char * | add_str | |||
) |
Send data to a particle specified by its ID.
Send Data addressed to one particle, specified by its net ID. The necessary control message ACL Types will be added automatically.
send_sock | Particle socket descriptor | |
send_data | Pointer to a CL packet that should be send. | |
add_str | dotted string containing the receivers ID |
int p_socket_send_buffer | ( | int | fd_out, | |
int | fd_in, | |||
const char * | buf, | |||
uint32_t | len, | |||
const uint8_t * | sendto, | |||
const uint8_t * | acl_type | |||
) |
Sending a data puffer to a particle.
Send a data-buffer to a particle specified by its ID. The buffer will be send in fragments.
The socket frag-option will be set to 1 for both sockets before sending the first packet.
fd_out | Particle socket descriptor used for sending the frag-packets | |
fd_in | Particle socket descriptor used for receiving frag-packets. NOTE: You can place NULL in here, but then you have to set the frag_option yourself! | |
buf | Pointer to the buffer, which holds the data you want to send. | |
len | Length of the data stored in buf | |
sendto | Pointer to an array containing the receivers ID | |
acl_type | Pointer to an array containing the ACL-type, which should be the subject of all packets send for this fragmentation. |
int p_socket_send_buffer_str | ( | int | fd_out, | |
int | fd_in, | |||
const char * | buf, | |||
uint32_t | len, | |||
const char * | sendto, | |||
const char * | acl_type | |||
) |
Sending a data puffer to a particle [ID and ACL as string].
Send a data-buffer to a particle specified by its ID. The buffer will be send in fragments.
The socket frag-option will be set to 1 for both sockets before sending the first packet.
fd_out | Particle socket descriptor used for sending the frag-packets | |
fd_in | Particle socket descriptor used for receiving frag-packets. NOTE: You can place NULL in here, but then you have to set the frag_option yourself! | |
buf | Pointer to the buffer, which holds the data you want to send. | |
len | Length of the data stored in buf | |
sendto | dotted string containing the receivers ID | |
acl_type | ACL-Type which should be the subject of all packets send for this fragmentation. |
p_frag_get_status
int p_socket_send_file | ( | int | fd_out, | |
int | fd_in, | |||
const char * | filename, | |||
const uint8_t * | sendto, | |||
const uint8_t * | acl_type | |||
) |
Sending data from a file to a particle.
Sends the data stored in a file to the particle specified by ID. The file will be copied to a buffer and send in fragments.
The socket frag-option will be set to 1 for both sockets before sending the first packet.
fd_out | Particle socket descriptor used for sending the frag-packets | |
fd_in | Particle socket descriptor used for receiving frag-packets. NOTE: You can place NULL in here, but then you have to set the frag_option yourself! | |
filename | Name of the file, from that the data should be send. | |
sendto | Pointer to an array containing the receivers ID | |
acl_type | Pointer to an array containing the ACL-type, which should be the subject of all packets send for this fragmentation. |
p_frag_get_status
int p_socket_send_raw | ( | int | sock, | |
const char * | data, | |||
size_t | len | |||
) |
Send raw data.
This function will be used by all other send functions (p_socket_send*) for sending a packet to the network. The packet will be sond on ALL devices specified at dest_addr of the socket sock. If you want to send the packet only on one single network device, you have to set this device explicit by using p_socket_set_ipdest
sock | Particle socket descriptor | |
*data | Pointer to the data buffer that should be send | |
len | Size of data buffer |
int p_socket_set_autoack | ( | ) |
Function only available at libparticle older then V1.0.0. Replaced by p_socket_set_option
int p_socket_set_blocking | ( | ) |
Function only available at libparticle older then V1.0.0. Replaced by p_socket_set_option
int p_socket_set_broadcast | ( | ) |
Function only available at libparticle older then V1.0.0. Replaced by p_socket_set_option
int p_socket_set_frag_option | ( | ) |
Function only available at libparticle older then V1.0.0. Replaced by p_socket_set_option
int p_socket_set_id | ( | int | sock, | |
const uint8_t * | add | |||
) |
Sets a particle sockets own net ID.
Sets the own net ID for socket sock to the value of the byte-array add. add must be the base address of an 8 byte long array.
sock | Particle socket | |
add* | Location, must be an 8 byte long array |
int p_socket_set_id_str | ( | int | sock, | |
const char * | addstr | |||
) |
Sets a particle sockets own net ID.
Sets the own net ID for socket sock to the value of the dotted string addstr. addstr must be a dotted string including either 8 or 4 numbers between 0 and 255. If addstr includes 8 numbers, the net ID of socket sock will be set to exactly this net ID. If addstr includes only 4 numbers, the net ID will be set to the virtual net ID "1.1.1.1.addstr".
sock | Particle socket | |
addstr | Location, must be a dotted string including 44 numbers |
int p_socket_set_ipdest | ( | int | sock, | |
const struct in_addr * | address | |||
) |
Set the destination-add for a socket.
Sets the IP-address, where the packets will be send to (broadcast, local broadcast, ...) Don't mix up with addressed sending!
sock | Particle socket descriptor | |
address | Address, where the packets should be brought to. |
int p_socket_set_ipdest_all | ( | int | fd | ) |
Set the destination-add for a socket [string].
Sets the IP-address, where the packets will be send to (broadcast, local broadcast, ...) Don't mix up with addressed sending!
fd | Particle socket |
int p_socket_set_ipdest_str | ( | int | sock, | |
const char * | address | |||
) |
Set the destination-add for a socket [string].
Sets the IP-address, where the packets will be send to (broadcast, local broadcast, ...) Don't mix up with addressed sending!
sock | Particle socket descriptor | |
address | Address, where the packets should be brought to. Must be a Pointer to a dotted string. |
int p_socket_set_ipsrc | ( | int | sock, | |
const struct in_addr * | address | |||
) |
Set the source-add for a socket.
Sets the IP-address, from where packets will be received. Don't mix up with addressed sending!
sock | Particle socket descriptor | |
address | Address, from where packets should be received. |
int p_socket_set_ipsrc_all | ( | int | sock | ) |
Set a Socket to receive all-mode.
Socket will receive packets from any source-address.
sock | Particle socket descriptor |
int p_socket_set_ipsrc_str | ( | int | sock, | |
const char * | address | |||
) |
Set the source-add for a socket [string].
Sets the IP-address, from where packets will be received. Don't mix up with addressed sending!
sock | Particle socket descriptor | |
address | Address, from where packets should be received. Must be a Pointer to a dotted string. |
int p_socket_set_lastacks | ( | int | counter | ) |
Set the number of packets, which should be stored to find doublets of acking-packets.
Set the number of acked packets, which should be hold in a queue an be compared with new received ack-packets to find doublets.
counter | Maximum number of packets that should be hold in the queue |
int p_socket_set_lastdups | ( | int | counter | ) |
Set the number of packets, which should be stored to find doublets.
Set the number of acked packets, which should be hold in a queue an be compared with new received packets to find doublets.
counter | Maximum number of packets that should be hold in the queue |
int p_socket_set_loc | ( | int | sock, | |
const uint8_t * | loc | |||
) |
Sets a particle sockets location-ID.
Sets the Location-ID for socket sock to the value of the byte-array loc. loc must be the base address of a 44 byte long array.
sock | Particle socket | |
loc* | Location, must be a 44 byte long array |
int p_socket_set_loc_str | ( | int | sock, | |
const char * | locstr | |||
) |
Sets a particle sockets location-ID.
Sets the Location-ID for socket sock to the value of the dotted string locstr. locstr must be a dotted string including 44 numbers between 0 and 255.
sock | Particle socket | |
locstr | Location, must be a dotted string including 44 numbers |
int p_socket_set_num_interfaces | ( | int | fd, | |
int | counter | |||
) |
Sets the number of interfaces, a socket will send to.
Sets the number of interfaces, a socket sends to. Counter must be smaller than the current number of interfaces. This function is especially usefull, if you want a socket, which has been opened by default values, only to send to the first found network device.
fd | Pointer to the socket from which you want to set the number of interfaces | |
counter | New number of interfaces the socket will send to. |
int p_socket_set_option | ( | int | fd, | |
int | option, | |||
int | mode | |||
) |
Sets a socket-option.
Sets the state of the socket-option specified by option to 0 or 1 (specified by mode). For Available options, see P_SOCKET_OPTIONS If you want to set more than one option to the same value at one time, you can concated them with |
p_socket_set_option replaces several funtions from libparticle < 1.0.0:
p_socket_set_broadcast, p_socket_set_blocking, p_socket_set_recv_option, p_socket_set_frag_option and p_socket_set_autoack. Please make the following changes in your programs:
p_socket_set_broadcast(socket); -> p_socket_set_option(socket, SOCKET_BROADCAST, 1); p_socket_set_blocking(socket, 0/1); -> p_socket_set_option(socket, SOCKET_BLOCKING, 0/1); p_socket_set_recv_option(socket, 0/1); -> p_socket_set_option(socket, SOCKET_RECV_ALL, 0/1); p_socket_set_frag_option(socket, 0/1); -> p_socket_set_option(socket, SOCKET_FRAG, 0/1); p_socket_set_autoack(socket, 0/1); -> p_socket_set_option(socket, SOCKET_AUTOACK, 0/1);
You can also set several options at the same time if you want to set them to the same value. For example:
p_socket_set_recv_option(socket, 1); p_socket_set_frag_option(socket, 1);
can be done by
p_socket_set_option(socket, SOCKET_RECV_ALL|SOCKET_FRAG, 1);
fd | Particle socket | |
option | The option you want to set | |
mode | 1 if option should be set to "YES" or 0 if option should be set to "no" |
int p_socket_set_recv_option | ( | ) |
Function only available at libparticle older then V1.0.0. Replaced by p_socket_set_option
int p_socket_set_retry | ( | int | sock, | |
uint8_t | retries, | |||
uint32_t | timeout | |||
) |
Sets the parameters for acknowledged sending.
Sets the number of retries and the time until timeout (per retry) for acknowledged sending.
sock | Particle socket | |
retries | Number of retries which should be done if no ack-packet is received | |
timeout | Time (in milliseconds), how long the particle waits for the ack-packet after each retry. |