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

x
?
Solved

Server development issues.

Posted on 2005-02-28
7
Medium Priority
?
266 Views
Last Modified: 2012-08-13
Hi all,

I am in process of developing a Server in C++ supporting multiple protocols. The server will be exposing various functionalities, and the clients can communicate over any of the protocols may be TCP, IPX, SAP, NETBEUI to access the server to access the functionalities exposed. The server doesnot know in advance which client is using what protocol.

example my server has functionality X()

and i have n number of client.
client1 is communicating over protocol TCP to access X()
client2 is communicating over protocol IPX to access X()

..
and so on.


We had already developed ( prepared a rough code sketch), a server that is able to handle multiple clients at the same time over TCP /IP. But now, we need to enhance the same so that it can intearct with clients irrespective of the protocol being used.

I am struck with following issue:

1) How to make the client-server flow  so that the server knows from which protocol the client has communicated so that the server can send the reply over the same protocol and this whole process is multithreaded.

What all steps are needed to take care of while building the system most efficient.


Please suggest. Also please feel free to send your comments/suggestions to make this system more efficient.

All suggestions are welcome.

Thanks,
rdh
0
Comment
Question by:rohitdivas
  • 4
  • 2
6 Comments
 
LVL 22

Assisted Solution

by:grg99
grg99 earned 300 total points
ID: 13419031
If these are all going to be connection-oriented protocols, with identical data formats, then you can share a fair amount of code.

But I suspect many of the protocols are going to require special-casing.

 In which case you may be able to only share some peripheral code, such as logging, file-caching, and back-end database lookups.  
0
 

Author Comment

by:rohitdivas
ID: 13419067
You are correct grg99 in that i will be reusing only the logging, multithreading , data-reading part of the code.

But the main issue is how to handle the various protocols connection-less as well as connection oriented. How the server handles multiple clients, some communicating over TCP , some over IPX, SAP?? This is the one of the major part of discussions. :)

Has anybody tackled similiar sort of situation before ???

All suggestions/ comments are welcome.

RDH
0
 

Author Comment

by:rohitdivas
ID: 13419163
Also, we need to make server in such a way that it may accept a request from connection oriented protocol as well as connection-less protocol at the same time. so need to develop a mechanism for the same the work for all conditions.

All suggestions are welcome.
rohit
0
Industry Leaders: 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!

 
LVL 22

Accepted Solution

by:
grg99 earned 300 total points
ID: 13420754
Hmmm, well I don't see any alternatives-- you're going to need a separate little loop to handle each of the protocols.   Each loop will have to create a socket for that protocol, then either wait for a connection or wait for a datagram.  Then read in the request.  Then you can call the generic "gimme back the data for this request" fnction that shoul dbe the same for all protocols.  Then when you get the answer, some protocol-specific code to send out the answer.

It's possible to do this in ONE module, with some clever use of method pointers-- that makes for less code and clearer code, but perhaps harder to debug.  

0
 

Author Comment

by:rohitdivas
ID: 13426433
hi grgg99,
thanks for the comments. what i can think of is making the module of structure as shown below and then call the appropriate object according to the protocol used by the client. Please comment.
===========
class protocol{

public:
      virtual void TCP_protocol() {cout<<"base tcp protocol"<<endl;} //functionality i.e when the connection is established using TCP protocol
      virtual void IPX_protocol() {cout<<"base ipx protocol"<<endl;}
      virtual void SAP_protocol() {cout<<"base SAP protocol"<<endl;}


};

class TCPp : public protocol {

public:
      void TCP_protocol() {cout<<"TCPp class fun()"<<endl;}
      void some_otherfunctions();
 
};

class IPXp : public protocol {

public:
      void IPX_protocol() {cout<<"IPXp class fun()"<<endl;}
      void some_otherfunctions1();
 
};

class SAPp : public protocol {
public:
      virtual void SAP_protocol() {cout<<"SAPp class fun()"<<endl;}
      void some_otherfunctions1();
 
};

//And in the main function  assigning
void main() {

protocol* pobj;
TCPp TCPobj;
IPXp IPXobj;

//And in loop, after checking the type of protocol ,
switch (protcol_type)
{
case TCP:
pobj = &TCPobj;
pobj->TCP_protocol();
break;

case IPX:
pobj = &IPXobj;
pobj->IPX_protocol();
break;

//and so on...
}

}

===========
Is this method seems feasible ?
rdh
0
 

Author Comment

by:rohitdivas
ID: 13438137
Please allow me to change my previous query,
I am in process of developing a server and currently analyzing various
models to develop the same. My basic requirement is that :


1) Server can be easily ported to UNIX/LINUX OSes, initiallly to be
developed for Windows platform.
2) Implementation will be done in C++
3) The interaction / communication will be done via XML
4) Server should accept the connection over any of the protocols
connection oriented or connection less.
5) The data to be transeferred between client-server is very light and
doesnot involve complex heavy data.


So m in process of evaluating various servers. Can anybody suggest a
server model that suits my requirement.


how about RPC mechanism ? Will RPC mechanism be able to satisfy above requirements ??


All suggestions are welcome.
Awaiting for the reply,
Thanks,
rdh


0

Featured Post

Industry Leaders: 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

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
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 how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
Suggested Courses

564 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