Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Mar : winosck.send not working correctly ?

www.cryer.info
Managed Newsgroup Archive

winosck.send not working correctly ?

Subject:winosck.send not working correctly ?
Posted by:"INT3" (int0..@gmail.com)
Date:Sun, 12 Mar 2006 23:23:48

Hello
i have created a chat program, and i am connecting to a remote server using
a non-blocking socket created by me.

i am receiving the userlist from the server
list: user1
list: user2
list: user3
list: user4
...
...

for each user in the list i send a command to the server asking for more
user information.
but it seems i am sending data to the server too quickly because i am only
receiving the extra information from the last user in the list.
if i use sleep(50) after the SendText procedure it works ok, if i use
sleep(40) i receive information from some users.
how can i fix this ? i dont want to use sleep(50) thank you

i am using this code to send data to the server.
function TTCPSocket.SendBufferTo(Socket: TSocket; Buffer: PChar;
  BufLength: Integer): Integer;
begin
  Result := 0;
  if (Socket <> INVALID_SOCKET) and (BufLength <> 0) then
  begin
    Result := WinSock.Send(Socket, Buffer^, BufLength, 0);

    if Result = SOCKET_ERROR then
    if Assigned(FOnError) then
      FOnError(Self, WSAGetLastError);
  end;
end;

procedure TTCPSocket.SendText(const s: string);
begin
  SendBufferTo(FSocket, PChar(s), Length(s));
end;

Replies:

www.cryer.info
Managed Newsgroup Archive