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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:57:14+00:00 2026-06-13T11:57:14+00:00

I have a client using TcpClient and a server using TcpListener. When the client

  • 0

I have a client using TcpClient and a server using TcpListener.
When the client disconnects from the server, how do i handle this?
And what if the program crashes, how do i handle the disconnect then?

  • 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-13T11:57:15+00:00Added an answer on June 13, 2026 at 11:57 am

    If your program crashes, all current Connections in the operating system will be closed.

    With the TCPClient you can assign that to your own class (in a constructor etc) and have an Event come out of your class that is for Disconnects.

    Then in your listener when a connection arrives, create your class add a reference to the class somewhere(List, Dictionary etc). Attach the event and proceed happily.

    If you want to handle a servered Connection Disconnect at the socket level it usually is only when you want to “Write” to the socket that you can actually detect that it’s no longer connected on the remote end unless you have graceful disconnect sent properly.

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

Sidebar

Related Questions

i have data structure i am passing this from server to client using data
Writing a client / server program and previously was using calls like this: TcpListener.AcceptTcpClient()
I have created my web socket server and client using this simple tutorial here
So in a nutshell, I have server set up using tcplistener / tcpclient, and
I have build a basic .NET server-client infrastructure using TcpListener and SocketClient. It is
I have Android client app that communicates with server using Socket . On my
I have a project to develop a client server application in java . This
I'm using a TcpClient passed to me from a TcpListener , and for the
I will have a client application using a proxy to a WCF Service. This
I have the following code: using (TcpClient client = new TcpClient()) { client.Connect(host, port);

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.