Re: Connection Timeout
From: Robert Harris (robertdotfdotharris_at_blueyonder.co.uk)
Date: 06/26/04
- Next message: jabro: "Single-stepping through /proc"
- Previous message: Bjorn Reese: "Re: Connection Timeout"
- In reply to: Michal J: "Connection Timeout"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 26 Jun 2004 14:35:57 +0100
Michal J wrote:
> Can someone add timeout to my func (connect_server)
>
> struct server
> {
> //glowne dane
> char *hostname;
> int port;
> char *username;
> //socket
> int sockfd;
> struct sockaddr_in serv_addr;
> struct hostent *server;
> };
>
> int connect_server(struct server **ser)
> {
> if(connect((*ser)->sockfd, (struct sockaddr*)&(*ser)->serv_addr,
> sizeof(struct sockaddr))== (-1))
> {
> return CODE_ERR_CONNECT;
> }
> return CODE_OK;
> }
>
>
>
> can this func return CODE_ERR_TIMEOUT after 10 sec timeout ??
Your connect() will time out but the timeout time is operating system
dependent. If it returns -1, you should look at errno to see why it failed.
Robert
- Next message: jabro: "Single-stepping through /proc"
- Previous message: Bjorn Reese: "Re: Connection Timeout"
- In reply to: Michal J: "Connection Timeout"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|