How to set connection time manually?

I use

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

      

to connect my iPhone to my computer (via WIFI) and it works fine so far. However, if the computer is not available, my iPhone tries to connect for more than a minute.

Is it possible to manually set the time to a new value, for example. 15 seconds?

+2


a source to share


1 answer


Since you are working with a low level socket, the easiest way is to use a function setsockopt

with a key SO_SNDTIMEO

. See the getsockopt / setsockopt page for more information .



0


a source







All Articles