This commit is contained in:
aozhiwei 2019-06-24 10:26:48 +08:00
parent 379e4a5b83
commit ca4bcdb5e2

View File

@ -13,7 +13,7 @@
#include <a8/a8.h>
#include <a8/tcpclient.h>
const int MAX_RECV_BUFFERSIZE = 1024 * 10;
const int MAX_RECV_BUFFERSIZE = 1024 * 64;
namespace a8
{
@ -120,6 +120,19 @@ namespace a8
socket_ = INVALID_SOCKET;
return false;
}
//set nodelay
{
int flag = 1;
int ret = ::setsockopt(socket_,
IPPROTO_TCP,
TCP_NODELAY,
(char *)&flag,
sizeof(flag));
assert(ret >= 0);
if (ret < 0) {
abort();
}
}
connected_ = true;
if (on_connect) {
on_connect(this);