23 #include <sys/types.h> 24 #include <sys/socket.h> 49 ret = closesocket(sock);
74 ret = bind(sock, address, length);
77 if (ret == SOCKET_ERROR)
105 ret = send(sock, buffer, *length, flags);
107 if (ret == SOCKET_ERROR)
137 ret = recv(sock, buffer, *length, flags);
140 if (ret == SOCKET_ERROR)
169 int flags,
const struct sockaddr *address,
170 size_t address_length)
174 ret = sendto(sock, buffer, *length, flags, address, address_length);
177 if (ret == SOCKET_ERROR)
212 int flags,
struct sockaddr *address,
size_t *address_length)
218 tmp = *address_length;
219 ret = recvfrom(sock, buffer, *length, flags, address, &tmp);
221 if (ret == SOCKET_ERROR)
226 tmp = *address_length;
227 ret = recvfrom(sock, buffer, *length, flags, address, &tmp);
233 *address_length = tmp;
251 const void *value,
size_t length)
253 if (!setsockopt(sock, level, option, value, length))
JAYLINK_PRIV bool socket_send(int sock, const void *buffer, size_t *length, int flags)
Send a message on a socket.
JAYLINK_PRIV bool socket_recv(int sock, void *buffer, size_t *length, int flags)
Receive a message from a socket.
#define JAYLINK_PRIV
Macro to mark private libjaylink symbol.
Internal libjaylink header file.
JAYLINK_PRIV bool socket_recvfrom(int sock, void *buffer, size_t *length, int flags, struct sockaddr *address, size_t *address_length)
Receive a message from a socket.
Public libjaylink header file to be used by applications.
JAYLINK_PRIV bool socket_sendto(int sock, const void *buffer, size_t *length, int flags, const struct sockaddr *address, size_t address_length)
Send a message on a socket.
JAYLINK_PRIV bool socket_bind(int sock, const struct sockaddr *address, size_t length)
Bind an address to a socket.
JAYLINK_PRIV bool socket_close(int sock)
Close a socket.
JAYLINK_PRIV bool socket_set_option(int sock, int level, int option, const void *value, size_t length)
Set an option on a socket.