1
0

Return a number of bytes read or sent.

This commit is contained in:
Alexander Andreev 2024-03-24 17:55:39 +04:00
parent 6990664f2f
commit b9b82a0e26
Signed by: Arav
GPG Key ID: 25969B23DCB5CA34
2 changed files with 4 additions and 4 deletions

View File

@ -51,7 +51,7 @@ void net_destroy(net_t *n) {
memset(&n->laddr, 0, sizeof(n->laddr));
}
int net_send(net_t *const n, const char *const buf, int buf_len) {
ssize_t net_send(net_t *const n, const char *const buf, int buf_len) {
if (n->fd == -1 || n->raddr.sin_addr.s_addr == 0)
return -1;
@ -61,7 +61,7 @@ int net_send(net_t *const n, const char *const buf, int buf_len) {
return 0;
}
int net_recv(net_t *const n, void *const buf, size_t buf_len) {
ssize_t net_recv(net_t *const n, void *const buf, size_t buf_len) {
if (n->fd == -1 || n->raddr.sin_addr.s_addr == 0)
return -1;

View File

@ -13,7 +13,7 @@ int net_client_init(net_t *const n, const int af_family, const char *const raddr
int net_server_init(net_t *const n, const int af_family, const char *const laddr, const int lport);
void net_destroy(net_t *n);
int net_send(net_t *const n, const char *const buf, int buf_len);
int net_recv(net_t *const n, void *const buf, size_t buf_len);
ssize_t net_send(net_t *const n, const char *const buf, int buf_len);
ssize_t net_recv(net_t *const n, void *const buf, size_t buf_len);
#endif /* _NET_H_ */