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

  • SEARCH
  • Home
  • 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 8110281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:41:39+00:00 2026-06-06T01:41:39+00:00

I am working on Lan based interoffice messaging system. The steps in my applications

  • 0

I am working on Lan based interoffice messaging system.

The steps in my applications are :

  1. Server starts and listen for clients
  2. Clients on connection gets the view of all the other connected clients.
  3. On connection to the server i do check in the database that if that client is authorize or not.
  4. if i dont check in the database on client connection to the server then the application does work normally other wise the client if not exists in the database the the client application got closed.

the related code is here :

public void CheckUserName(string userName)
        {

        if (userName != "Usman")  // checking in database( a static name)
        {
              //Check if the username is registered
              Send("sorry@Invalid Username, try another Username!!");
              Disconnect();
              return;
        }
        else
        {
            //If name is not duplicate then the client is connected
            this.connected =true;
            this.userName =userName;
            //Build the Usernames list and send it to the client
            StringBuilder userList = new StringBuilder();
            userList.Append(this.clientID);
            Hashtable clientTable =ClientList.GetList;
            foreach(DictionaryEntry d in clientTable)
            {
                //Seperate the usernames by a '@'
                userList.Append("@");
                userList.Append(d.Value.ToString());
            }
            //Start the llistening
            lock(myClient.GetStream())
            {
                AsyncCallback GetStreamMsgCallback = new AsyncCallback(GetStreamMsg);
                myClient.GetStream().BeginRead(recByte,0,1024,GetStreamMsgCallback,null);
            }
            //Send the Userlist
            Send(userList.ToString());
            //Raise the Connected Event
            if(Connected!=null)
            {
                EventArgs e = new EventArgs();
                Connected(this, e);
            }
        }
    }

Do anyone could suggest that what to do to get rid of this bad thing?

  • 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-06T01:41:41+00:00Added an answer on June 6, 2026 at 1:41 am

    Have you considered initially querying the database for all enabled users when the server starts then caching those results? this way you can avoid having to query on every user connection. You can store the entitled users in a Dictionary or some other style of lookup table.

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

Sidebar

Related Questions

I am working on a Mac that has an Ethernet connection to a LAN
all! Now I'm working on a p2p file share program in LAN(I use python).
I am working on a interface in java swing.we have four system connected with
I am currently working on server application that has to deal with reasonable amount
I'm working on a Wake on LAN service that will run from a web
I have a client written in Python for a server, which functions through LAN.
I'm working on a web app that works fine inside the LAN using HTTP
I'm working on setting up version control on a company LAN using the setup
Now in my program in c# that simulates the working of a lan-messenger I
I'm working on a C# application that queries a SQL Server 2008 Express instance

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.