Monday, 19 August 2013

How to solve two way communication in Socket?

How to solve two way communication in Socket?

I have a C++ Server running in Unix, and a C# UI application running in
Windows. I used socket to communicate between server and client. It has
been performing very good.
But now, I have a request need to be sent from client side to Server side.
And this request need to be processed and return something, which means
the server and client need to perform sync communication.
I coded my own protocol based on Boost socket(C++) and
System.Net.Sockets(C#), basically what it does is to send a message and
receive a message. And right now the protocol is performing async
communication. For example I can send an request for some data, and after
server processes those data it just send them back. At the same time, the
Client side continue processing other information not just blocking
waiting for the information it requests from server.
How do I change the structure to make it can communicate both sync and async?
And I have seen some ppl suggesting protobuf by google, I am just
wondering whether protobuf supports both sync and async? Is Protobuf a
heavy protocol like WCF or a light weight protocol? Because I am gonna
transmit Tick Data thru them, Will be a lot.

No comments:

Post a Comment