Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9174449
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:45:31+00:00 2026-06-17T16:45:31+00:00

How would one design a class for server, which is managed by simple client

  • 0

How would one design a class for server, which is managed by simple client messages, in a proper way? This server uses event model to inform parent application about client requests. It uses asynchronous sockets. Server load is probably very limited.

This is what I would try:

class Client
{
private Socket sock;

public event EventHandler Start;
public event EventHandler Stop;
public event RequestEventHandler Request;

public Client(TcpClient Client)
//sock.BeginReceive

private void OnReceived(IAsyncResult ar)
//Dissect incoming stream into messages
//Call event handlers
//sock.BeginReceive

public void AnswerRequest(byte[] answer) //either this way or
private void OnSend(IAsyncResult ar)     //direct call of sock.BeginSend
}

class Server
{
private TcpListener Listener;
public List<Client> Clients;

public event EventHandler ClientConnected;

public Server(int port)
//Listener.BeginAcceptTcpClient

private void AcceptTcpClientCallback(IAsyncResult ar)
//Get TcpClient
//Create new Client with TcpClient as a parameter
//Launch ClientConnected, where one should sign for Client events
//Listener.BeginAcceptTcpClient
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:45:31+00:00Added an answer on June 17, 2026 at 4:45 pm

    i’m using nito async library, it has simpleserversocket and simple client.
    very easy to use.
    Nito Async

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is this how one would normally design classes? One class = 1 Table. How
How would one follow the proper steps in order to license a package under
Why would one use func( const Class &value ) rather than just func( Class
How would one write a sql server DDL script that can: For each table
I've got an application which generates SecretKeys, one per client. These need to be
Possible Duplicate: Difference between static class and singleton pattern? Why would one ever require
This is a generic C++ design question. I'm writing an application that uses a
I would like to design class A implements interface C and reduce the visibility
One question for design about communicating between fragments, why would someone use a bit
I'm planning to use Netty to design a TCP Server. When the client connects,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.