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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T05:54:46+00:00 2026-05-25T05:54:46+00:00

My application is working as a client application for a bank server. The application

  • 0

My application is working as a client application for a bank server. The application is sending a request and getting a response from the bank. This application is normally working fine, but sometimes

The I/O operation has been aborted because of either a thread exit or
an application request

error with error code as 995 (0x3E3) comes through.

public void OnDataReceived(IAsyncResult asyn)
{
    BLCommonFunctions.WriteLogger(
        0,
        "In: OnDataReceived",
        ref swReceivedLogWriter, 
        strLogPath, 
        0);
    try
    {
        SocketPacket theSockId = (SocketPacket)asyn.AsyncState;

        int iRx = theSockId.thisSocket.EndReceive(asyn); // Here the error is coming
        string strHEX = BLCommonFunctions.ByteArrToHex(theSockId.dataBuffer);
    }
}

Once this error starts to come for all transactions after that same error begin to appear, so how can I sort out this problem?

If possible then with some sample code.

  • 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-25T05:54:46+00:00Added an answer on May 25, 2026 at 5:54 am

    995 is an error reported by the IO Completion Port. The error comes since you try to continue read from the socket when it has most likely been closed.

    Receiving 0 bytes from EndRecieve means that the socket has been closed, as does most exceptions that EndRecieve will throw.

    You need to start dealing with those situations.

    Never ever ignore exceptions. They are thrown for a reason.

    There is nothing that says that the server does anything wrong. A connection can be lost for a lot of reasons, such as an idle connection being closed by a switch/router/firewall, shaky network, bad cables, etc.

    I’m saying that you must handle disconnections. The proper way of doing so is to dispose the socket and try to connect a new one at certain intervals.

    As for the receive callback a more proper way of handling it is something like this (semi pseudo code):

    public void OnDataReceived(IAsyncResult asyn)
    {
        BLCommonFunctions.WriteLogger(
            0,
            "In: OnDataReceived",
            ref swReceivedLogWriter,
            strLogPath,
            0);
        try
        {
            SocketPacket client = (SocketPacket)asyn.AsyncState;
    
            int bytesReceived = client.thisSocket.EndReceive(asyn); // Here the error is coming
            if (bytesReceived == 0)
            {
              HandleDisconnect(client);
              return;
            }
        }
        catch (Exception err)
        {
           HandleDisconnect(client);
        }
    
        try
        {
            string strHEX = BLCommonFunctions.ByteArrToHex(theSockId.dataBuffer);
    
            // Do your handling here
        }
        catch (Exception err)
        {
            // Your logic threw an exception. handle it accordinhly
        }
    
        try
        {
           client.thisSocket.BeginRecieve(.. all parameters ..);
        }
        catch (Exception err)
        {
           HandleDisconnect(client);
        }
    }
    

    The reason to why I’m using three catch blocks is simply because the logic for the middle one is different from the other two. Exceptions from BeginReceive/EndReceive usually indicates socket disconnection while exceptions from your logic should not stop the socket receiving.

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

Sidebar

Related Questions

I'm working on a client/server application where the connections from the client to the
I am working on a client-server application that uses boost::serialization library for it's serialization
I'm working on a client-server Android application and trying to figure out how to
I am working on an application where client and server share an object model,
I am working on a .net rich client server application, the client call the
I'm working on a client/server application in C#, and I need to get Asynchronous
Part of the application I'm working on for my client involves sending emails for
Suppose this simple scenario: My client has an already working .net application and he/she
Just got a request from my boss for an application I'm working on. Basically
I am working on a client/server (WPF/WCF) application using the MVVM pattern. Properties on

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.