Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

What is the structure in design a simple msg soft bus on tcp

Posted on 2006-10-22
5
Medium Priority
?
234 Views
Last Modified: 2010-04-01
thx
0
Comment
Question by:turbot_yu
  • 3
  • 2
5 Comments
 
LVL 39

Accepted Solution

by:
itsmeandnobodyelse earned 2000 total points
ID: 17790380
>>>> a simple msg soft bus

what is a soft bus?

If you mean messages via tcp in general, the design of a struct that is a kind of container for various types of messages depends very strongly on the requirements. If you are passing text messages only - think of a chat-room - you don't need a struct but simply pass the text message as char array. Or if it more complex take that:

struct Message
{
     int size;
     int msgType;
     unsigned char buffer[1];
};

That kind of struct dynamically can be increased by allocationg the needed storage and setting the size accordingly.

Of course you may add sender and receiver information, e. g. id numbers, or page numbers if the message needs to be send in parts.

You also can pass some (class) id of the data  you are passing. By means of that id you could invoke a function via function pointer that reads the data and construct a proper class object of the required type. These kind of methods were called 'factory'. And the technique to *stream* class data to a buffer and vice versa is called 'serialising'.

Regards, Alex

0
 

Author Comment

by:turbot_yu
ID: 17793801
is there any detail explain of it, or any samples.
0
 
LVL 39

Assisted Solution

by:itsmeandnobodyelse
itsmeandnobodyelse earned 2000 total points
ID: 17794221
>>>> is there any detail explain of it, or any samples.

Could you specify your requirements?

As I said, for simple text messages there is no struct needed.

0
 

Author Comment

by:turbot_yu
ID: 17795345
I just want to learn the basic structure for tcp program of software bus,

I totally do not have ideas of it.
0
 
LVL 39

Expert Comment

by:itsmeandnobodyelse
ID: 17795777
>>>> tcp program of software bus

I never heard that expression. Can you find a definition? Or a further explanation (of the term only) ?



0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

916 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