static int write_int (int fd, int value)
{
value = htonl(value);
return write(fd, &value, sizeof(value));
}