Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Nov : Re: Indy V9 - is this possible?

www.cryer.info
Managed Newsgroup Archive

Re: Indy V9 - is this possible?

Subject:Re: Indy V9 - is this possible?
Posted by:"Remy Lebeau (TeamB)" (no.spam@no.spam.com)
Date:Thu, 2 Nov 2006 11:17:19

"Michael Fritz" <spam_athome@yahoo.de> wrote in message
news:7o585be0sgz1.dzdnt2a3q3ia.dlg@40tude.net...

>    Command : TCommandString;
>    Connection : TCommandConnection;

What are those types actually declared as?  They both have string fields in
them.  Are the fields declared as dynamic 'string' types, or as fixed-length
character arrays?  If they are declared as 'string', then you will not be
able to use Read/WriteBuffer() to read the records properly.

>     Connection.Client := GStack.LocalAddress;

I would suggest using the IP that the socket is actually bound to.  In a
multi-homed environment, the LocalAddress may not return the same IP that
the socket is actually using.

    Connection.Client := FIPClient.Socket.Binding.IP;

> My assumption was that calling FIPClient.SendCmd reaches the
> procedure CMDClientConnection

It does.

> My problem is that the coding (.ReadBuffer) in CMDClientConnection
> does not work since the FIPClient.WriteBuffer has not been triggered so
far.

Yes, it does work.  Indy is a blocking library.  ReadBuffer() will wait
indefinately for the WriteBuffer() data to actually arrive (unless you have
a read timeout specified).

> So, how can I use the CommandHandlers to first send a command and
> second to send some data to the server immediately after sending the
> command?

You already are using it the correct way (provided your records themselves
are set up properly).  The timing of the calls is not the cause of whatever
issue you are having.  Something else is happening.  Without seeing more
code, my guess would be that the records are using 'string' types, and thus
cannot be used with Read/WriteBuffer() correctly.  Please show a more
complete code snippet.


Gambit

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive