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 6155169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:23:24+00:00 2026-05-23T20:23:24+00:00

I am writing (trying) a client server application with these 3 layers: Client and

  • 0

I am writing (trying) a client server application with these 3 layers:

  1. Client and Server wrapper classes for TcpClient and TcpServer, handling connection, multi-threading and NetworkStream read/block/write routines.
  2. Business logic BizClient and BizServer which implements Protocol and expose only “FetchDataFromServer()” kind of methods which hides underlying Protocol.
  3. Application and UI level. This level wraps BizClient and BizServer to run as Windows Services, Console apps or WinForms applications.

Now I am on the way to implement support for async calls on layer 1 upwards. Async calls in the .NET style typically involves an object state so that callback can know from where it should continue.

In the end on each layer from 3 to 1 to the .NET framework, I have to encapsulate the object state from the upper layer, add current layer’s state and then pass to next lower layer. This means writing a different struct on each layer and it looks cumbersome.

struct State
{
   object bizState; // cannot know higher layer state type at lower layers   
   object muchInfo;
}

struct BizState
{
   object appState;
   object muchInfo;
}

struct AppState
{
   object muchInfo;
}

Is there a better and quick way to do it rather than writing structs to wrap the states?

  • 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-05-23T20:23:25+00:00Added an answer on May 23, 2026 at 8:23 pm

    Well, technically: no; However, there are many workarounds to this problem. Consider using a generic state object (dump structures), which can have an InnerState (Just like an Exception). you can also choose to not to focus on state objects to much (they were mostly used during the earlier periods of .NET when we didnt have lambda’s and anonymous methods) and rely on closures instead.Lastly you can skip Event based Async and lean on TPL.

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

Sidebar

Related Questions

We are trying to convert out old school client server application into a N-Tier
I'm writing an application and I'm trying to tie simple AJAX functionality in. It
Writing my first Linq application, and I'm trying to find the best way to
I am trying to snoop on a log file that an application is writing
I am writing a basic word processing application and am trying to settle on
I'm currently in the process of writing a client server app as an exercise
This is a conceptual programming question. I'm writing a tcp server/client program in Java.
I'm currently writing a client in ActionScript 3 that talks to a Red5 application/media
I writing a server and a client and keep getting 'bind: Socket operation on
I am writing 2 small programs (a server and a client) and whenever I

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.