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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:52:33+00:00 2026-06-15T05:52:33+00:00

To summarize my situation, I am writing a server program that opens a UDP

  • 0

To summarize my situation, I am writing a server program that opens a UDP socket with which any number of clients can communicate. I receive UDP packets using code similar to the following:

EndPoint sender = new IPEndPoint(IPAddress.Any, 0);
try
{
    count = socket.ReceiveFrom(buf, ref sender); // 'count' and 'buf' are defined elsewhere
    // If an exception isn't thrown, 'sender' will now contain the EndPoint of the client that sent the packet.
}
catch(SocketException e)
{
    if(e.ErrorCode == 10054)
    {
        // How do I get the EndPoint that caused the error?
        // The 'sender' variable above does not contain the EndPoint.
    }
}

I receive error code 10054 (“An existing connection was forcibly closed by the remote host”) when my server sends a packet to a client that has closed its own socket. I would like to stop sending packets to that client so that SocketExceptions stop getting thrown, which severely hurts my server’s performance.

But my problem is that I don’t know how to get the EndPoint of the particular client that was forcibly closed. (The ‘sender’ variable above isn’t set to anything useful before the exception is thrown.) How can I find that EndPoint?

A less-ideal but still workable solution would be to simply disable the SocketException from being thrown.

Any ideas?

Thanks!

  • 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-15T05:52:35+00:00Added an answer on June 15, 2026 at 5:52 am

    I guess I got an idea. You should create and maintain a list of your clients andthis list will hold all the endpoints of them (as well as the other useful information you might need).

    Data transmission will then happen to “connected” clients whereas all the other yet “unknown” computers will be generally try to “connect” to you though IPAddress.Any.

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

Sidebar

Related Questions

Can anyone summarize or bulleted list the types of things that go in each
I'm facing a problem that I can summarize as it follows: I have a
I've got a situation which can be summarized in the following: class Test {
Can someone please summarize the advantages of creating an Azure WokerRole vs. simply starting
The title is hardly understandable, but I'm not sure how to summarize that another
I apologize for the terrible title...it can be hard to try to summarize an
It seems to be common knowledge that hash tables can achieve O(1), but that
I have an EMPLOYEE table in a SQL Server 2008 database which stores information
SUMMARIZE: I misunderstood the usage of content script. And that leads to this issue.
i'm in a situation my mind is blocked en hope someone can help me.

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.