Home > Software engineering >  SERVER client access client corresponding multiple class object, how to do?
SERVER client access client corresponding multiple class object, how to do?

Time:11-23

Ask a question:
SERVER side to accept the client's connection, each client is in the case of a task is different, so the design for multiple CClientObject classes, such as: CClientObject1, CClientObject2 ~ ~ ~

How to access the CLIENT design, according to different requirements to instantiate a CLIENT class object? The train of thought about how to implement?
The SOCKET sClient=: : the accept ();
//to do... According to different requirements, instantiate a client class object,

In fact, is the client's different business logic is different, the underlying socket communication no difference, of course, how to realize the different clients different business logic?

CodePudding user response:

Receiving/sending and processing of data processing logic on separate, the elaboration on the business logic of data processing, to the different function modules to deal with,

CodePudding user response:

reference 1/f, 7-eleven's response:
receiving/sending and processing of data processing logic on separate, the elaboration on the business logic of data processing, to the different functional modules to deal with,

Yes, it's such a consideration, I'm not clear how is that for different business, instantiate the different business processing class, I know what you mean,
SocketClient responsible for communications, for example, a simple for business layer to realize sendata/recvdata operations, to provide the corresponding interface, then according to the needs of the business, there are 3 types of business correspondence, for example,
If according to the received data sent to analysis different business module, isn't it requires socketClient class declares three analytical support business objects, such as:

CodePudding user response:

For example:
SocketClient: serviceParser1 serviceParser2, serviceParser3

After I was supposed to assume the client is accept, design a method directly instantiate an inherited from socketClient business module, or by a business module allocated a parser object to business it can also be, purpose is to achieve the client and business modules 1 to 1 binding,
CClientObj1: : socketClient
CClientObj2: : socketClient
CClientObj3: : socketClient

Or other ideas, can achieve reasonable architecture can,

CodePudding user response:

In fact, I understand this requirement, I need a process of business statement? After a client connection, if you don't do any data interaction, is unable to determine its business requirements, or in OnRecvDataComplete event fires when the recognition of the business, then how to establish a socket and business modules binding relationship? Void Pointers, anyhow finally need clear business can invoke the business analysis interface to do things, or to all business unified abstract interface, unlikely,

For guidance,
  • Related