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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:30:17+00:00 2026-06-01T09:30:17+00:00

I have a growing application with multiple usercontrols, windows, etc that all send a

  • 0

I have a growing application with multiple usercontrols, windows, etc that all send a lot of data across a socket that’s established when the program is opened (signing into a server). If the server ever dies or something along those lines, I’d like to be able to handle the ensuing SocketException in a more graceful way than wrapping pretty much every code block in try-catch statements for that specific exception.

void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)

Using that should catch any unhandled exception that gets thrown, would it be a bad idea to simply check if the exception is a socketexception and then launch the “you have disconnected, please reconnect” code? With this application, you can safely assume that 99% of any socketexception thrown would be because of a server disconnect.

And while I’m on the subject, any idea how you check the exception type after it’s already caught? With the above code, I can get the original exception simply with e.Exception. I’m not really sure how to word an if statement to check the type of an exception.

  • 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-01T09:30:18+00:00Added an answer on June 1, 2026 at 9:30 am

    IMHO this is a very bad idea…

    A better solution would be to move the code accessing the socket into its own class… anything in the application needing to interact with the server goes through that class… this way any socket-related exception can be handled accordingly in a central location.

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

Sidebar

Related Questions

I have a SQL Server that holds a lot of data. An application, running
I have an application that has several objects (about 50 so far, but growing).
A have a database on MS-SQL Server 2008 that is growing a lot, year
In my application, I have a lot of RichTextBoxes that are created dynamically in
i have a data access layer that abstracts the rest of the application away
I have windows application I wrote. I installed it on virtual server (vmware) that
I have an ASP.NET application in VS2008 that is growing larger and am developing
We have an application that is growing in users and the infragistics WebDataGrid and
I have an ASP.NET / C# web application that is using a lot of
Is it possible to have growing files on amazon s3? That is, can 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.