Log in

View Full Version : Problem with keepalive option in wsaioctl


someshchandra
02-03-2006, 03:03 PM
Hi


I have been trying to establish tcp connection using a pocketpc client but am facing problem...the code is give below

m_socket = socket(AF_INET, SOCK_STREAM, 0);


.....


linger lgr;


lgr.l_onoff = 1;


lgr.l_linger = 5;


setsockopt(m_socket, SOL_SOCKET, SO_LINGER, (const char*)&lgr,
sizeof(lgr)4)


....


struct tcp_keepalive keepalive;


keepalive.onoff = 1;


keepalive.keepalivetime = 60*1000 ;


keepalive.keepaliveinterval = 10*1000; DWORD returned;


if(WSAIoctl(m_socket,SIO_KEEPALIVE_VALS,&keepalive,


sizeof(keepalive),NULL,0,&returned,NULL,NULL) == SOCKET_ERROR)


{


throw some error



}


It is in this last statement WSAIoctl that i get an error code
WSAEINVAL 10022. What am i missing ?

Thanks in advance


Somesh