how to form queues for data storage and how to Handle the matching of the Responses

S

saleem

Dear friends,

I am working on the problem which deals with the data management
of requests and how should we match the responses for the requests to
compare the correct Response.


my problem is like this, say I am intermediary node between "m"
and "n" nodes . n nodes send any of the "p"type of requests to any one
of the "m" nodes on the other side. I have to forward the requests to
one of the node in "m" nodes. The uniqueness of the request is that it
has specific unique resquest filed say "type of service"

I am thinking of maintaining " p" no .of queues for "n" nodes
seperately to send the request and store the requests information in my
intermediary device so that I can compare the responses easily i.e. I
will have to maintain the n*P queues but I want some simple
implementation for this problem. can any one help me out.


my another problem is that if I am maintaining a linked list data
structure for "P" types of requests for each of "n" nodes while I
forward the request I am facing a problem at the data storage of the
request. since after geeting the request from one side of the "n"
nodes. I am forming the structure as local variable to send the request
and storing it in the linked list but I doubt I will loose the data in
the linked list after existing from the function even though I store
the address of in the linked list. how to overcome the problem.

please can anyone specify me where I can get good inforamtion on
this kind of data storage and data matching in "C" implementation using
linux as platform and thread programming.

please help in this regard to solve the problem.

Thanking you all in advance,

Sulaiman
 
M

Malcolm

saleem said:
my problem is like this, say I am intermediary node between "m"
and "n" nodes . n nodes send any of the "p"type of requests to any one
of the "m" nodes on the other side. I have to forward the requests to
one of the node in "m" nodes. The uniqueness of the request is that it
has specific unique resquest filed say "type of service"

I am thinking of maintaining " p" no .of queues for "n" nodes
seperately to send the request and store the requests information in my
intermediary device so that I can compare the responses easily i.e. I
will have to maintain the n*P queues but I want some simple
implementation for this problem. can any one help me out.
Have a queue for each of the "m" nodes, and keep all the information in your
structure.
If there are p types of messages, the natural structure would be a union,
with a single "type" member so you know what the type of a message is.
my another problem is that if I am maintaining a linked list data
structure for "P" types of requests for each of "n" nodes while I
forward the request I am facing a problem at the data storage of the
request. since after geeting the request from one side of the "n"
nodes. I am forming the structure as local variable to send the request
and storing it in the linked list but I doubt I will loose the data in
the linked list after existing from the function even though I store
the address of in the linked list. how to overcome the problem.
LInked lists are good for queues. if you free the data, you cannot then use
it, so use a temporary and call memcpy() to copy the contents to the
temporary. Then delete the node, pass the data in the temporary to your "m"
structures, and if necessary copy again into some permanent structure in the
"m" nodes.

Don't worry about the inefficiency, almost certainly it won't matter.
Programming clarity is what counts.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top