Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Jul : [EQ] what will happen if we write to client port after it's disconnecting?

www.cryer.info
Managed Newsgroup Archive

[EQ] what will happen if we write to client port after it's disconnecting?

Subject:[EQ] what will happen if we write to client port after it's disconnecting?
Posted by:"Ahmadi" (ahmadisolness..@yahoo.com)
Date:Tue, 24 Jul 2007 10:14:36 +0430

hi
im using indy 9.0.0
after diconnecting a user ( consider that they cut the cable ) , if i write
any data to the client port , then my write function without any exception
will be hang.
see my follow code, my network thread is in line 4 , it trying to check that
the client is connected yet or no, cosider that client is connected, then in
line 6 when it try to write data to client port , never reach to line 7 and
my thread will be down (hanged).

1.              if Assigned(client.Thread) then
2.              if len<>0 then
3.              begin
4.                commform.addExlog('Uploader thread --> Writing data to the
client port...');
5.                client.Thread.Connection.CheckForDisconnect(false,true);
6.                client.Thread.Connection.WriteBuffer(t,sizeof(t));
7.                commform.addExlog('Uploader thread --> Write has been
completed.');
8.              end;

i need a timeout write command from indy that if it can not write to client
(for example after 3000 ms) return timeout exception. or just return a
exception.
such as read command. because read command of indy have a optional paramater
that is timeout.

Thank you for any help
H.Ahmadi

Replies:

www.cryer.info
Managed Newsgroup Archive