Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Dec : Re: TIdTcpClient / Server and pointer (indy 10)

www.cryer.info
Managed Newsgroup Archive

Re: TIdTcpClient / Server and pointer (indy 10)

Subject:Re: TIdTcpClient / Server and pointer (indy 10)
Posted by:"Remy Lebeau (TeamB)" (no.spam@no.spam.com)
Date:Mon, 25 Dec 2006 14:14:47

"Dejan Petrovic" <dejanbng@removeThis.ztbclan.com> wrote in message
news:458f9a30@newsgroups.borland.com...

> there is any method to write pointer to connection ?

No.  Sending direct memory buffers was eliminated in Indy 10, in order to
support .NET (which does not allow such things)

> for example I would like to write instead :
<snip>
> and to read that on server like pointer too.

You will not be able to do that directly with Indy 10.  You must wrap the
raw data in a TIdBytes when sending it (there is a RawToBytes() function for
that), or else write your data to a TStream and send that instead.  On the
reading side, you can read a TIdBytes and then use BytesToRaw(), or else
read the data as a TStream.

> for a moment I writing pointer to stream, sending and read from stream
> once received.

That is fine.

> ms := TMemoryStream.Create;
> AContext.Connection.IOHandler.ReadStream(ms, -1, true);//this is received
ok

No, it is not ok.  You are setting the AReadUntilDisconnect parameter to
True when it needs to be False instead.  Your code is frozen because it is
waiting for the client to disconnect from the server before then returning
the TStream data.

> AContext.Connection.IOHandler.Write('OK');//this freeze till client is
> connected

There is no way your code could be getting that far to begin with.


Gambit

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive