A Shorter Delay for TCPSocket.Isconnected?

For a OS X desktop app communicating with phones, I establish either a timer-polled TCPSocket or a similar Serial. While I can check the connection state for the serial quite fast with a RTS check in the timer poll, the TCPSocket takes a long, long time until isConnected gets set to False. I can even write to it without an error for some time.
Is there a faster way to check if there is no receiver on the other end of the line anymore?

Ulrich I have wondered the same thing, but never did get around to troubleshoot it. +1 for me having this same delay issue with TCPSockets.

Hmm, I could imagine this having to do with the delay:

TCP_CONNECTIONTIMEOUT The TCP_CONNECTIONTIMEOUT option allows to specify the timeout, in seconds, for
new, non established TCP connections. This option can be useful for both active
and passive TCP connections. The default value is specified by the MIB variable
net.inet.tcp.keepinit.

https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man4/tcp.4.html

[quote=89246:@Ulrich Bogun]Hmm, I could imagine this having to do with the delay:

TCP_CONNECTIONTIMEOUT The TCP_CONNECTIONTIMEOUT option allows to specify the timeout, in seconds, for
new, non established TCP connections. This option can be useful for both active
and passive TCP connections. The default value is specified by the MIB variable
net.inet.tcp.keepinit.

https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man4/tcp.4.html[/quote]
You can use this command to see the values BTW:.
sysctl net.inet.tcp

Its 75 Seconds by default on OS X 10.9.2:

net.inet.tcp.keepinit: 75000

Now the question arises: How do I modify this from inside Xojo?

THis makes the change in real time via a SHELL:
sysctl -w net.inet.tcp.keepintvl=20000

Im still looking for where to make this change permanently in a conf file most likely sysctl.conf. Stay tuned.

http://rolande.wordpress.com/2010/12/30/performance-tuning-the-network-stack-on-mac-osx-10-6/

If you create a /etc/syscntl.conf (you can do a man syscntl.conf) you can setup your prefered OS TCP defaults.

This is from the /etc/syscntl.conf I just tested

kern.ipc.maxsockbuf=4194304
kern.ipc.somaxconn=2048
kern.ipc.nmbclusters=2048
net.inet.tcp.rfc1323=1
net.inet.tcp.win_scale_factor=4
net.inet.tcp.sockthreshold=16
net.inet.tcp.sendspace=1042560
net.inet.tcp.recvspace=1042560
net.inet.tcp.mssdflt=1448
net.inet.tcp.v6mssdflt=1428
net.inet.tcp.msl=15000
net.inet.tcp.always_keepalive=0
net.inet.tcp.delayed_ack=3
net.inet.tcp.slowstart_flightsize=20
net.inet.tcp.local_slowstart_flightsize=20
net.inet.tcp.blackhole=2
net.inet.udp.blackhole=1
net.inet.icmp.icmplim=50
net.inet.tcp.keepintvl=20000

HTH