diff --git a/tgp-net.c b/tgp-net.c index 0ce2b9e..efa0563 100644 --- a/tgp-net.c +++ b/tgp-net.c @@ -392,7 +392,7 @@ static void try_write (struct connection *c) { // debug ("try write: fd = %d\n", c->fd); int x = 0; while (c->out_head) { - int r = write (c->fd, c->out_head->rptr, c->out_head->wptr - c->out_head->rptr); + int r = send (c->fd, (const char *)c->out_head->rptr, c->out_head->wptr - c->out_head->rptr, 0); if (r >= 0) { x += r; c->out_head->rptr += r; @@ -468,7 +468,7 @@ static void try_read (struct connection *c) { #endif int x = 0; while (1) { - int r = read (c->fd, c->in_tail->wptr, c->in_tail->end - c->in_tail->wptr); + int r = recv (c->fd, (char *)c->in_tail->wptr, c->in_tail->end - c->in_tail->wptr, 0); if (r > 0) { c->last_receive_time = tglt_get_double_time (); stop_ping_timer (c);