[icq-devel] Newcomer

Starman fm.grattepain at wanadoo.fr
Sat Nov 30 14:28:29 CET 2002

On Saturday, November 30, 2002, at 01:02 PM, Rüdiger Kuhlmann wrote:

>> --[Christophe Minguet (freesurf)]--<c.minguet at freesurf.fr>
>> His only way to know he is disconnected seems to be to write on the
>> socket ...(KEEPALIVE)
> Correct. Because if the other side considers the the connection 
> closed, it
> won't acknowledge packets sent but but refuse them (like resetting the
> non-existent connection).
>> I don't remember in C ... But in java you can't know a socket is 
>> closed
>> on the other side when u try to read it, only way is to write in it.
> Actually you can have a connection open for a long time without 
> actually
> having a connection, As long as no side actually tries to send 
> something. So
> Flap(5) is the way to go. You might even use a timer and check whether 
> you
> haven't received something for n minutes, and if not, re-send your 
> status,
> and if you then still don't receive anything (like: the status of 
> everyone
> on your contact list), the connection is somewhat ill.

Here is what I tried (on a WIFi network):

- connect to the server
- send packets, chat with people
- disable the network interface (802.11 card)
- send data : toto=send(m_socketDescriptor, data, dataLength, 0);
- check the toto value... but I always get toto = dataLength, even if 
the interface is down.

I also tried with "write"...

here is my socket creation :

m_socketDescriptor = socket(AF_INET, SOCK_STREAM, 0);

if (m_socketDescriptor != -1)
// Connect to the remote host.
if (connect(m_socketDescriptor, (struct sockaddr *)&sockAddr, 
sizeof(sockAddr)) < 0)

should I modify something ? ioctl or setsockopt ?


More information about the icq-devel mailing list