Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


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

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Screencast - Getting to Know the Pipeline

572 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