[fpc-pascal] "Aborting " a socket operation under Linux
Luca Olivetti
luca at ventoso.org
Fri May 29 20:29:50 CEST 2009
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
Thanks anyway
>
> Rainer
>
> Am Freitag, 29. Mai 2009 18:43 schrieb Luca Olivetti:
>> I have a thread managing a socket (using synapse but I don't think that
>> it matters, just keep in mind that each operation is blocking).
>> Inside the thread, I try to connect, send and read in a loop.
>> If I see an error, I just exit the loop and, if
>> the thread is terminated, that's it, otherwise I try a new connection
>> and so on and so forth.
>> In the thread destructor (called in the context of the main thread),
>> apart from terminate, I use the synapse AbortSocket call (which in turn
>> calls CloseSocket, which in turn calls fpClose under linux), which
>> supposedly terminates any pending call on the socket in the thread, so
>> it can terminate immediately.
>> It works fine under windows (i.e the socket calls terminate immediately
>> inside the thread), but under Linux it doesn't until the timeout
>> expires, and that's not very convenient, especially if I'm trying to
>> quickly close the program and I have many of those threads running.
>> Is there a way to make the pending call exit immediately?
>>
>> Bye
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
More information about the fpc-pascal
mailing list