Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Sep : Re: GStack

www.cryer.info
Managed Newsgroup Archive

Re: GStack

Subject:Re: GStack
Posted by:"Remy Lebeau (TeamB)" (no.spam@no.spam.com)
Date:Wed, 27 Sep 2006 16:39:42

"Roberto Meneghini" <rmeneghini@separationsystems.com> wrote in message
news:451adee5$1@newsgroups.borland.com...

>    Item.Caption(GStack.LocalAddresses.Strings[0]);

Caption is a property, not a function.

Every time you access the LocalAddress or LocalAddresses property, the list
is re-populated, so you should only access the property once, not over and
over.  Also, every time your loop is adding a new ListView item, it is
always assigning the first address in the list as the Caption instead of
using the current address from the loop.

Use this code instead:

    var
        I: Integer;
        Item: TListItem;
        Addresses: TIdStrings;
    begin
        lvLog.Items.BeginUpdate;
        try
            Addresses := GStack.LocalAddresses;
            for I := 0 to Pred(Addresses.Count) do
            begin
                Item := lvLog.Items.Add;
                Item.Caption := Addresses[I];
            end;
        finally
            lvLog.Items.EndUpdate;
        end;
    end;

> As I mentioned the only INDY10 component that I've
> dropped on my form is "TIdTCPServer".

Using any Indy component will initialize GStack at runtime.

> It is listening at port 500 and it is active.

That has no effect whatsoever on GStack's ability to get the local
addresses.


Gambit

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive