Return a number of bytes read or sent.
This commit is contained in:
parent
6990664f2f
commit
b9b82a0e26
@ -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;
|
||||
|
||||
|
@ -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_ */
|
Loading…
Reference in New Issue
Block a user