| View previous topic :: View next topic |
| Author |
Message |
Tony Caduto Guest
|
Posted: Wed Jan 21, 2004 11:23 pm Post subject: streaming a object? |
|
|
Is it possible to stream a tobject with Indy?
If so does anyone have a example?
Thanks,
--
Tony
|
|
| Back to top |
|
 |
Chad Z. Hower aka Kudzu Guest
|
Posted: Wed Jan 21, 2004 11:48 pm Post subject: Re: streaming a object? |
|
|
"Tony Caduto" <acaduto (AT) amsoftwaredesign (DOT) com> wrote in news:400f09e2$1
@newsgroups.borland.com:
| Quote: | Is it possible to stream a tobject with Indy?
If so does anyone have a example?
|
Just use Delphi's streamning fucntions which stream to text, then write it
accross to Indy.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
Want more Indy stuff? Try the Atozed Indy Portal at
http://www.atozedsoftware.com/
* More Free Demos
* Free Articles
* Extra Support
ELKNews - Get your free copy at http://www.atozedsoftware.com
|
|
| Back to top |
|
 |
Eugene Mayevski [SecureBl Guest
|
Posted: Thu Jan 22, 2004 12:54 am Post subject: Re: streaming a object? |
|
|
Chad Z. Hower aka Kudzu wrote:
| Quote: | Is it possible to stream a tobject with Indy?
If so does anyone have a example?
Just use Delphi's streamning fucntions which stream to text, then write it
accross to Indy.
|
Delphi streaming works only with TPersistent (this is what TPersistent
is for). If one wants to stream something else, he needs to write his
own serialization mechanism. Not very hard, I think, but only for
TPersistent. For TObject it might be harder.
--
Eugene Mayevski
EldoS Corp., CTO
Security and networking solutions
http://www.eldos.com
|
|
| Back to top |
|
 |
Dennis Landi Guest
|
Posted: Thu Jan 22, 2004 3:21 am Post subject: Re: streaming a object? |
|
|
"Eugene Mayevski [SecureBlackbox]" <mayevski (AT) eldos (DOT) org> wrote
| Quote: | Chad Z. Hower aka Kudzu wrote:
Is it possible to stream a tobject with Indy?
If so does anyone have a example?
Just use Delphi's streamning fucntions which stream to text, then write
it
accross to Indy.
Delphi streaming works only with TPersistent (this is what TPersistent
is for). If one wants to stream something else, he needs to write his
own serialization mechanism. Not very hard, I think, but only for
TPersistent. For TObject it might be harder.
|
Tony, I'd recommend going the RTTI route and only pack/unpacking the
properties you need.
I believe http://www.bigattichouse.com has a freeware RTTI to XML to RTTI
component that you can examine to see how its done....
As Eugene points, out tPersistent has ready made has RTTI facilities to do
this. The TypInfo.pas unit is pretty easy to read....
-d
|
|
| Back to top |
|
 |
Tony Caduto Guest
|
Posted: Thu Jan 22, 2004 3:36 pm Post subject: Re: streaming a object? |
|
|
I have to go through all that to stream a simple tobject?
why can't I just do a writebuffer(myobject, sizeof(myobject))
isn't a object just a junk of memory?
--
Tony Caduto
AM Software Design
Inexpensive Corporate Instant Messaging
http://www.amsoftwaredesign.com
"Dennis Landi" <none[at]none.com> wrote
| Quote: | "Eugene Mayevski [SecureBlackbox]" <mayevski (AT) eldos (DOT) org> wrote in message
news:400f1f6f (AT) newsgroups (DOT) borland.com...
Chad Z. Hower aka Kudzu wrote:
Is it possible to stream a tobject with Indy?
If so does anyone have a example?
Just use Delphi's streamning fucntions which stream to text, then
write
it
accross to Indy.
Delphi streaming works only with TPersistent (this is what TPersistent
is for). If one wants to stream something else, he needs to write his
own serialization mechanism. Not very hard, I think, but only for
TPersistent. For TObject it might be harder.
Tony, I'd recommend going the RTTI route and only pack/unpacking the
properties you need.
I believe http://www.bigattichouse.com has a freeware RTTI to XML to RTTI
component that you can examine to see how its done....
As Eugene points, out tPersistent has ready made has RTTI facilities to do
this. The TypInfo.pas unit is pretty easy to read....
-d
|
|
|
| Back to top |
|
 |
Chad Z. Hower aka Kudzu Guest
|
Posted: Thu Jan 22, 2004 4:21 pm Post subject: Re: streaming a object? |
|
|
"Tony Caduto" <acaduto (AT) amsoftwaredesign (DOT) com> wrote in news:400fee05$1
@newsgroups.borland.com:
| Quote: | I have to go through all that to stream a simple tobject?
|
If its from TPersistent or down just use the built in streaming, its really
easy.
| Quote: | why can't I just do a writebuffer(myobject, sizeof(myobject))
isn't a object just a junk of memory?
|
Yes, with local references and even out of object references that wont make
any sense. Also you'll get just the pointer with the above. :)
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"
Need extra help with an Indy problem?
http://www.atozed.com/indy/experts/support.html
ELKNews - Get your free copy at http://www.atozedsoftware.com
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Thu Jan 22, 2004 8:18 pm Post subject: Re: streaming a object? |
|
|
"Tony Caduto" <acaduto (AT) amsoftwaredesign (DOT) com> wrote
| Quote: | I have to go through all that to stream a simple tobject?
|
Yes.
| Quote: | why can't I just do a writebuffer(myobject, sizeof(myobject))
|
That wouldn't work if the object contained pointers or other dynamic
content.
| Quote: | isn't a object just a junk of memory?
|
It is more involved than that.
Gambit
|
|
| Back to top |
|
 |
|