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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:16:04+00:00 2026-05-26T18:16:04+00:00

In my multi-threading server app, a thread per client is generated in this way:

  • 0

In my multi-threading server app, a thread per client is generated in this way:

    While (True)
        counter += 1
        clientSocket = serverSocket.AcceptTcpClient()
        log.debug("Client No: " + Convert.ToString(counter) + " started!")
        Dim client As New handleClinet
        clients.Add(clientSocket)
        client.startClient(clientSocket, Convert.ToString(counter))
    End While

and in handleClinet:

    Public Sub startClient(ByVal inClientSocket As TcpClient, ByVal clineNo As String)
        Me.clientSocket = inClientSocket
        Me.clNo = clineNo
        Dim ctThread As Threading.Thread = New Threading.Thread(AddressOf doChat)
        ctThread.Name = "client" + clineNo
        ctThread.Start()
    End Sub

As you can see, the thread is made with the name client1, client2, etc. When a user signs out, a command is send to the server along with the clientID. But how can I kill the specific client process?

Something like:

Public Sub killClient(ByVal clientID As Int32)
    'Code to kill "client"+clientID
End Sub
  • 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-26T18:16:05+00:00Added an answer on May 26, 2026 at 6:16 pm

    Threads are just execution vehicles. Any time you think you need to push a thread around, think instead about what the thread is doing. When you don’t need your doctor anymore, you don’t kill him. You leave his office.

    If you want to shut down the client cleanly, set a ‘shutdown’ flag in the client structure. Have the code that handles the client check this flag periodically. Forget about what thread is doing it, it’s the client you want to shut down.

    If that’s too passive, shutdown the TCP connection to the client. That will cause any code that touches the client’s connection to get an error.

    Forget about the fact that it happens to be a dedicated thread that’s handling the client. You wrote the code. Code it so that it stops handling the client when that’s no longer appropriate by checking if it’s appropriate to handle a client before handling it.

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

Sidebar

Related Questions

I have a client server application with multi-threading. The server side is failing with
My question pertains to multi-threading in Java. I'm translating an app I wrote in
I am using multi threading concept to run some process. this process uses the
I've been doing simple multi-threading in VB.NET for a while, and have just gotten
Is multi-threading possible in a simple java server using udp connectionless protocol? give an
I'm not the best with multi-threading, and this is a bit complicated, so hopefully
Since the original thread ( Multi-threading with Linq to SQL ) has become quite
I have a client/server app. The server component runs, uses WCF in a 'remoting'
I am developing a multi-threading application, which is deadlocking. I am using Visual C++
I am relatively new to multi-threading and want to execute a background task using

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.