Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Jun : FContextList problems Indy10.1.5

www.cryer.info
Managed Newsgroup Archive

FContextList problems Indy10.1.5

Subject:FContextList problems Indy10.1.5
Posted by:"Jacques" (jacques.no..@btinternet.com)
Date:Sun, 4 Jun 2006 02:49:50

Hi

I'm having problems retrieving a list of names of connected clients.
Basically i have a client/server program. The server stores the names of
conneted clients in a list when they connect. The server also have a
function that sends that list to any client that request it. But when the
list arrives at the requesting client only ONE of the many client names is
shown. So, i'm not sure what is going on. here's the code that does the job:

server code
procedure TMyContext.SendNicks;
    var
        List: TList;
        Context: TMyContext;
        I: Integer;
    begin
        List := FContextList.LockList;
        try
            if List.Count > 0 then
            begin

                for I := 0 to List.Count-1 do
                begin
                    Context := TMyContext(List[I]);
                    if Context <> Self then
Connection.IOHandler.WriteLn('list@'+ Context.Nick);
                end;

            end else
                Connection.IOHandler.WriteLn('list@No other members
available.');
        finally
            FContextList.UnlockList;
        end;
    end;


Client code:
FMsg is the entire 'list' sent by the server
//the list is after the @ delimiter
thelist:= Copy(FMsg, Pos('@', FMsg)+1, Length(FMsg)-Pos('@', FMsg));
//add the list of names to the listview
form1.listview.Clear;
form1.li.caption:=thelist;

Should i be creating a tstringlist to recieve the list on the client side?
Any suggestions would be much appreciated.

Thanks

Replies:

www.cryer.info
Managed Newsgroup Archive