views:

28

answers:

1

I use

connect(socketfd, (struct sockaddr*)&remoteAddr, sizeof(remoteAddr))

to connect my iPhone to a computer (over WIFI) and it works fine so far. However if the computer is out of reach, my iPhone tries to establish a connection for more than a min.

Is there a posibility to set the time manually out to a new value, e.g. 15 sec?

A: 

As you deal with low-level socket, the simplest way is to use the setsockopt function with the SO_SNDTIMEO key. See the getsockopt/setsockopt man page for more information.

Laurent Etiemble