- iovecs[i].iov_base = const_cast<char*>(sendq[i].data());
- iovecs[i].iov_len = sendq[i].length();
- rv_max += sendq[i].length();
+ iovec iovecs[MYIOV_MAX];
+ for (int i = 0; i < bufcount; i++)
+ {
+ iovecs[i].iov_base = const_cast<char*>(sendq[i].data());
+ iovecs[i].iov_len = sendq[i].length();
+ rv_max += sendq[i].length();
+ }
+ rv = writev(fd, iovecs, bufcount);