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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:51:45+00:00 2026-06-04T18:51:45+00:00

Simply put, is it possible to reuse a socket after a TimedOut exception has

  • 0

Simply put, is it possible to reuse a socket after a TimedOut exception has been caught? How can I do it?

Long story:

I have 2 threads, both using the same socket. One is sending packets (let’s call it thread A) to a remote server while the other (thread B) is listening for confirmation packets of those sent packets. Thread A will pause (with Monitor.Wait) when some condition is met, waiting for a Monitor.Pulse to continue. When thread B receives a packet, it calls Monitor.Pulse and thread A continues to do it’s thing…

The problem is that packets can be lost and thread B will wait indefinitely for a packet that won’t receive while thread A is waiting for a pulse. The whole program will “block”. My first thought was to set a receive timeout and catch the associated exception. When that happens, I call Monitor.Pulse and thread A can continue while thread B will keep waiting for another packet.

But this doesn’t work. When the exception is caught, the socket will close and the app will crash when thread A tries to send a new packet, since they are using the same socket.

How can I prevent this behavior?

  • 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-04T18:51:47+00:00Added an answer on June 4, 2026 at 6:51 pm

    TCP Packets cannot be lost (they can but that’s on a whole different layer).
    If there is a communication error the socket will close.
    However if you’re using UDP Communications and you’ve selected a receive timeout, there is no reason you shouldn’t be able to try again.

    Check This out.
    And Read the remarks here.

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

Sidebar

Related Questions

I have a large data set of nucleotide sequences (long strings simply put) which
I have an issue with grabbing an image dynamicly. Simply put, how can I
Simply put: What is the most effective way to share / reuse code between
Simply put I want what http://www.reddit.com/ and http://news.ycombinator.com/ have to the left of every
Simply put, I'm getting this error in the Product Admin of Magento after adding
I can't seem to get back on track with this one. I simply put
Simply put: I have a database design in my head and I now want
Simply put, I have a table with, among other things, a column for timestamps.
Simply put I'm trying to sync two slideshows created using widgetkit lib in a
Put simply: it causes a massive memory leak within an hour if I work

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.