×
Namespaces

Variants
Actions
Revision as of 15:50, 17 June 2008 by ebra (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

WISE Timeout

From Nokia Developer Wiki
Jump to: navigation, search

Contents

Description

Maemo Platform

int server_start(wise_server* server,int time_out)
{
struct sockaddr_rc client_addr = { 0 };
socklen_t opt = sizeof(client_addr);
char buf[50];
 
struct timeval timeout;
fd_set readfds;
 
int error;
 
memset(&timeout,0,sizeof(timeout));
timeout.tv_sec = time_out;
timeout.tv_usec = 0;
 
FD_ZERO(&readfds);
FD_SET(server->server_socket,&readfds);
 
/* put server socket into listening mode */
error = listen(server->server_socket,0);
if ( error ) return error;
 
sprintf(buf,"Wait time %d sec",time_out);
logger_add_message(logger,buf);
 
select(server->server_socket+1,&readfds,NULL,NULL,&timeout);
 
if ( FD_ISSET(server->server_socket,&readfds) )
{
/* accept one connection */
server->client_socket = accept(server->server_socket,
(struct sockaddr *)&client_addr,&opt);
ba2str(&client_addr.rc_bdaddr,server->client_address);
server->client_connected = TRUE;
}
else
{
server->client_connected = FALSE;
return WISE_CONNECTION_ERROR;
}
return WISE_OK;
}

S60 Platform

Links

63 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×