MAX_LINGER_SECONDS定义在哪里 [英] Where is MAX_LINGER_SECONDS definition
本文介绍了MAX_LINGER_SECONDS定义在哪里的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的,
我曾尝试关闭套接字,但是VC编译器报告错误消息错误C2065:"MAX_LINGER_SECONDS":未声明的标识符".
您能让我知道必须包含哪个头文件吗?
Dear,
I was try close socket but VC compiler report error message "error C2065: ''MAX_LINGER_SECONDS'' : undeclared identifier".
Would you let me know, which header file have to include?
void CFtpc::CloseSocket( SOCKET *socket )
{
fd_set read_fds;
fd_set error_fds;
struct timeval t_timeout;
if( *socket != INVALID_SOCKET )
{
if( shutdown( *socket, SD_BOTH ) != SOCKET_ERROR )
{
FD_ZERO( &read_fds );
FD_ZERO( &error_fds );
FD_SET( *socket, &read_fds );
FD_SET( *socket, &error_fds );
t_timeout.tv_sec = MAX_LINGER_SECONDS;
t_timeout.tv_usec = 0;
select( 1, &read_fds, NULL, &error_fds, &t_timeout );
}
closesocket( *socket );
*socket = INVALID_SOCKET;
}
}
推荐答案
找不到任何这样的东西.
也许是自定义的常量.
您可以使用#define
自己定义.
Didn''t find any such thing.
Maybe its a custom defined constant.
You could define it yourself using#define
.
该值是应用程序特定的值,因此不能在通用标头中声明.遵循超人的建议并自己定义.
That value is an application specific value, and therefor cannot be declared in a common header. Follow supermans suggestion and define it yourself.
这篇关于MAX_LINGER_SECONDS定义在哪里的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文