简体   繁体   English

如何将Poco :: Net :: HTTPClientSession的套接字设置为TCP_NODELAY?

[英]How do I set a Poco::Net::HTTPClientSession's socket to TCP_NODELAY?

My initial try was to get the socket and set it to no delay after construction. 我最初的尝试是获取套接字,并在构建后将其设置为不延迟。

client_session.socket().setNoDelay(true);

That threw 那扔

terminate called after throwing an instance of 'Poco::Net::InvalidSocketException'
what():  Invalid socket

I then tried to construct my http client session with my own socket that I set the no delay myself - it threw the same exception. 然后,我尝试使用自己设置的套接字构建我的http客户端会话,我自己设置了no delay-它引发了相同的异常。

How do I make my http client have TCP_NODELAY? 如何使我的http客户端具有TCP_NODELAY?

As exception says - you are trying to set option on invalid socket . 如异常所示-您正在尝试在无效套接字上设置选项。 However, there is no need to set TCP_NODELAY because HTTPSession does it on connect. 但是,无需设置TCP_NODELAY,因为HTTPSession会在连接时进行设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM