En/na Luca Olivetti ha escrit:
En/na Rainer Stratmann ha escrit:
Am Freitag, 29. Mai 2009 20:29 schrieb Luca Olivetti:
En/na Rainer Stratmann ha escrit:
May be socketoption so_linger would be a solutuion.
http://www.developerweb.net/forum/archive/index.php/t-2982.html
Nope, no change.
I'm testing a connect to a non existent host in the thread and it won't
terminate before the (quite long, 3 minutes, since it ignores the 5
seconds I set) timeout, no matter what the value of linger->l_onoff
In case of connection to a host:
Simply use nonblocking socket mode, than you get immediately a result.
And then you can write your own timeout function.
Ok, the problem was that synapse used an integer instead of a timeval
for SO_SNDTIMEO/SO_RCVTIMEO. I don't want to rewrite synapse and I want
my program to work at least under windows and linux, so the nonblocking
way is not an option.
*However* that's not my problem: I expect that a close would interrupt
the socket operation (so the thread can terminate) and it doesn't.
Well, I tried with a c program and it does the same (closing the socket
from the main program doesn't interrupt the ongoing connect in a
thread), so it's not a freepascal problem.
Googling for a way to abort the socket operation this mailing list
thread is the first result, so I guess that there's no way to do it :-(
Bye
--
Luca
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal