Board index » delphi » [Indy 9] TCP client blocks my server

[Indy 9] TCP client blocks my server


2005-04-12 06:55:43 PM
delphi69
Hello everybody,
I have a TCP Server and a client which connect to this server.
If my Server answer to this client and the client blocks when he
receives the answer (I put a stop point on the
TIdTCPConnection.ReadSTream), my server will be blocked.
How can I prevent this problem ?
Franck
 
 

Re:[Indy 9] TCP client blocks my server

If you are using a Indy tcp server only the one thread is blocked until
the data is sent, this is how it is supposed to work.
On the client you should put your read/write operations in a thread so
it will not cause you program to hang while receiving data.
Use postmessage to communicate from the thread to the clients main form.
Tony
Franck C writes:
Quote
Hello everybody,

I have a TCP Server and a client which connect to this server.
If my Server answer to this client and the client blocks when he
receives the answer (I put a stop point on the
TIdTCPConnection.ReadSTream), my server will be blocked.

How can I prevent this problem ?

Franck
 

Re:[Indy 9] TCP client blocks my server

"Franck C" <XXXX@XXXXX.COM>writes
Quote
I have a TCP Server and a client which connect to this server.
If my Server answer to this client and the client blocks when he
receives the answer (I put a stop point on the
TIdTCPConnection.ReadSTream), my server will be blocked.
That is normal for blocking sockets. If you block the client from reading,
then the socket's internal buffers will fill up with unread data, and the
server will block waiting for the buffers to clear before sending more data.
That is the nature of blocking sockets to begin with.
Gambit
 

Re:[Indy 9] TCP client blocks my server

"Remy Lebeau (TeamB)" <XXXX@XXXXX.COM>wrote :
Quote
"Franck C" <XXXX@XXXXX.COM>writes
news:425ba954$XXXX@XXXXX.COM...

>I have a TCP Server and a client which connect to this server.
>If my Server answer to this client and the client blocks when he
>receives the answer (I put a stop point on the
>TIdTCPConnection.ReadSTream), my server will be blocked.

That is normal for blocking sockets. If you block the client from
reading,
then the socket's internal buffers will fill up with unread data, and the
server will block waiting for the buffers to clear before sending more
data.
That is the nature of blocking sockets to begin with.

Hello, what situation will block the client from reading?
 

Re:[Indy 9] TCP client blocks my server

"Tony Caduto"
writes news:XXXX@XXXXX.COM...
Quote
If you are using a Indy tcp server only the one thread is blocked until
the data is sent, this is how it is supposed to work.
On the client you should put your read/write operations in a thread so it
will not cause you program to hang while receiving data.
Use postmessage to communicate from the thread to the clients main form.
Hi, what situation will block the client from reading and a thread is dead,
the next thread will be okey? Pls advice.
 

Re:[Indy 9] TCP client blocks my server

"JS" <XXXX@XXXXX.COM>writes
Quote
Hello, what situation will block the client from reading?
Please read Frank's original message that started this discussion thread.
Gambit
 

Re:[Indy 9] TCP client blocks my server

JS a écrit :
Quote

Hello, what situation will block the client from reading?

For example, the client thread that must read TCP datas is blocked by a
CriticalSection or other thing.