【发布时间】:2014-05-21 23:38:49
【问题描述】:
我正在尝试使用 boost.asio 库发送大量字节,如下所示:
void tcp_send(boost::asio::io_service &io, const char *dst_ip, uint16 dst_port)
{
uint8 *sbuff;
size_t slen;
ip::tcp::socket sock(io);
sock.connect(ip::tcp::endpoint(ip::address::from_string(dst_ip), dst_port));
sbuff = new uint8[100412];
sbuff[0] = 67;
sbuff[1] = 193;
sbuff[2] = 136;
sbuff[3] = 60;
boost::asio::async_write(sock, boost::asio::buffer(sbuff, 100412),
boost::bind((&send_handler), placeholders::error));
}
当我使用 Wireshark 检查传输的字节数时,发送方始终只发送 65536 字节的数据,不包括 TCP 标头字节。那么可能是什么问题呢? 有没有需要修改的参数。
我在 linux ubuntu 上运行该应用程序。好像传输的最大字节数是2^16。
【问题讨论】:
标签: c++ linux sockets boost-asio