- if ((sent_length= write(ptr->hosts[x].fd, buffer, send_length) == -1))
- return MEMCACHED_WRITE_FAILURE;
- if (sent_length != send_length)
+ sent_length= send(ptr->hosts[x].fd, buffer, send_length, 0);
+
+ if (sent_length == -1 || sent_length != send_length)