How can I pass object  through socket using c++

Posted on 2003-03-19
Medium Priority
Last Modified: 2007-12-19
I am trying to pass the object ( for example image) through socket with c++. I know we can use  recv and send to pass the char* but I could find any function to pass the object or structure.

Thank you
Question by:philipli
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

sparticus1701 earned 100 total points
ID: 8167361
Sockets are only capable of sending byte streams, hence the char*s.  If you want to send an object, what you need to do is have someway to serialize it's data into a byte stream, and send that.  Then on the other side, you'll want something that can create a new object with the serialized data.

Assisted Solution

isprabu earned 100 total points
ID: 8173551
CORBA can be used to handle distributed objects (between client & servers). CORBA takes care of seriealising/marhsalling of objects across network (internally it uses tcp and hence sockets!) and at application level you don't have to worry about sending/packing/receiving/unpacking the objects. CORBA uses stub/proxy/IDL files for this.
In the NT world, DCOM is the preferred alternative for CORBA. because it is native to Windows and so give better performance.
Just for your info:
In the Java world, you can use RMI or EJB for sending objects across.

Expert Comment

ID: 9447001
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Post your closing recommendations!  No comment means you don't care.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Six Sigma Control Plans

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question