[fpc-pascal] "Aborting " a socket operation under Linux

Luca Olivetti luca at ventoso.org
Fri May 29 22:24:49 CEST 2009


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.

Bye
-- 
Luca



More information about the fpc-pascal mailing list