[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MiNT] MiNTNet: connect timeout?



Am Freitag, den 04.01.2013, 04:35 +0100 schrieb Pierre Ton-That <ptonthat@club-internet.fr>:
Hi,

Facing a blocking problem when doing a tcp_open with STinG and/or
Gluestik. I tried to use MiNTNet socket and fconnect, but it seems
it's also blocked at connection attempt.

During my work on Draconis Emailer and the other draconis internet tools
I encountered problems with blocking sockets. From what I understood,
it was the result of some difference between the Draconis network API and the MiNT network API. On the other hand, why did nobody hit the problem before the Firebee era. (Maybe because of the Mint 1.17 bugfix for connect()/select() - see below).
But I doubt this is what you encounter here....

Is there a way to test an opened port(s) before the connection
attempt, or use a timeout in the connect function? Or do programs use
a separate process they can kill if connection is too long?

Set the socket to be no-blocking before you do connect(),
Then do something like:

connect();
select(10sec timeout);
parse_select_result();

Additional Info:
select() + connect() combination was fixed in MiNT 1.17. There was a bug, where select reported connection success, altough the connection wasn't yet established.

Greets,
Ole