Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Jun : Probably hit by TCP buffer!
| Subject: | Probably hit by TCP buffer! |
| Posted by: | "m utku karatas" (m.utku..@g_o_o_g_l_e_smailservice.com) |
| Date: | 22 Jun 2006 17:59:26 |
Hi all,
I'm using TCP for my IPC needs. Currently I hit a bug where the client
app hangs in a winsock Send function. Let me explain the situation:
The server app is built with delphi and indy 9 components, (I know it is
old but is enough as I only use basic stuff). This server has a thread
for communication which is like
//-----------------------------------------------
proc Thread.Execute;
begin
while not Terminated do
begin
size := fSocket.ReadCardinal(False);
fData := fRunSocket.ReadString(size);
Synchronize(Sync_OnReceivedData);
end;
end;
//-----------------------------------------------
And my client is a C++(VS) app which pumps(/gets) data to(/from) the
server. The code there is roughly:
//-------------------------------------------
void SendData(){
........
sock.Send((char*)&size, sizeof(int)); // using my simple wrappers
sock.Send(data.c_str(), size);
}
//-------------------------------------------
Till now I thought my primitive protocol is enough and bullet-proof but
now I have this freeze situation in my client's(C++ one) "Send" winsock
call(according to the debugger).
I am told that the problem relates to TCP buffer but how is it possible
that it gets full when the server is insistingly try to recv from the
socket(see Delphi code above)?
BTW what would you use to peek on this TCP buffer?
--
Thanks and best regards.
M. Utku Karatas