Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. An unhandled exception of type 'System.Net.Sockets.SocketException' occurred in System.dll

An unhandled exception of type 'System.Net.Sockets.SocketException' occurred in System.dll

Scheduled Pinned Locked Moved .NET (Core and Framework)
helpcsharpdata-structures
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    ganeshmyname
    wrote on last edited by
    #1

    Hi, while reading buffer from TCP/IP continuously after some time i am getting this error.. could you please anyone help me to resolve it....

    An unhandled exception of type 'System.Net.Sockets.SocketException' occurred in System.dll

    Additional information: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full

    An unhandled exception of type 'System.IO.IOException' occurred in System.dll

    Additional information: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.

    Regards, Ganesh

    D J 2 Replies Last reply
    0
    • G ganeshmyname

      Hi, while reading buffer from TCP/IP continuously after some time i am getting this error.. could you please anyone help me to resolve it....

      An unhandled exception of type 'System.Net.Sockets.SocketException' occurred in System.dll

      Additional information: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full

      An unhandled exception of type 'System.IO.IOException' occurred in System.dll

      Additional information: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.

      Regards, Ganesh

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Without seeing the relevant code it's impossible to tell you anything useful.

      A guide to posting questions on CodeProject

      How to debug small programs
      Dave Kreskowiak

      1 Reply Last reply
      0
      • G ganeshmyname

        Hi, while reading buffer from TCP/IP continuously after some time i am getting this error.. could you please anyone help me to resolve it....

        An unhandled exception of type 'System.Net.Sockets.SocketException' occurred in System.dll

        Additional information: An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full

        An unhandled exception of type 'System.IO.IOException' occurred in System.dll

        Additional information: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.

        Regards, Ganesh

        J Offline
        J Offline
        jinzai
        wrote on last edited by
        #3

        Greetings. I would like to see your code, too but -- I can offer you some help anyway. Always use try/catch for network communications and db access and ignore anyone that tells you not to -- unless it is your boss, but even then -- you should use it. I am saying this -- not to chastise you or puff myself up -- I am saying it because if you do you will not only learn how to fix this yourself -- you will learn to write code that can handle issues and also it will perform better. Generally, I will wrap most all of a function in try/catch if it involves communications or database access. You do not need it everywhere, just in key areas that warrant it. If you ignore it altogether -- your application will halt because you did not use try/catch-- not good for anyone and not good for you. If you use try/catch -- at least you know that an error occurred and at least the code can exit gracefully instead of spitting out that page that tells your users that your code just died on them. You said -- continuously -- but, the exception seems to be telling a different story. I suspect that your buffer read is either missing data that is in the buffer, or you are not servicing it often enough or -- your buffer is too small to begin with. TCP has some built-in defense against many errors, but it cannot force you to service the socket properly, so -- it is the buffer, the socket properties or your read code. How large is the expected data? Mostly, guessing buffer sizes is a bad idea -- either you get one too small or you waste resources by making it too large. This is not a career where guessing is a good strategy and asynchronous communications demands that we code properly and not make assumptions.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups