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. C#
  4. Why do i get This Error ??????

Why do i get This Error ??????

Scheduled Pinned Locked Moved C#
sysadminhelpquestion
2 Posts 2 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.
  • S Offline
    S Offline
    snouto
    wrote on last edited by
    #1

    i have a server and client networked application , each time i test them , gives me an error "Unable to read data from the transport connection: The I/O operation has been aborted because of either a thread exit or an application request. " Here is the code for the client , knowing that the server doesn't disconnect the current client , the server still see the client as connected the client code as follows : void RunClient() { try { IPAddress ip = IPAddress.Parse("127.0.0.1"); int port = 5079; IPEndPoint ipendpoint = new IPEndPoint(ip, 5079); //create the tcp client client = new TcpClient(); client.Connect(ipendpoint); Console.WriteLine("The Client has been Connected Successfully"); //begin Reading lock (client.GetStream()) { (client.GetStream()).BeginRead(data, 0, data.Length, new AsyncCallback(IASyncResultCallBack), client); } } catch (Exception s) { this.Invoke(new SetText(SetTextMethod), new object[] { s.Message }); } } void IASyncResultCallBack(IAsyncResult ar) { try { //get the tcp client instance TcpClient currentclient = ar.AsyncState as TcpClient; if (currentclient != null) { if (currentclient.GetStream().CanRead) { //get the instance of the data int count = (currentclient.GetStream()).EndRead(ar); if (count <= 0) { //disconnect the current client currentclient.Close(); currentclient = null; GC.Collect(); return; } //build the Received Text ReadText(data, 0, data.Length); } } //now begin Reading again lock (currentclient.GetStream()) { currentclient.GetStream().BeginRead(data, 0, data.Length, new AsyncCallback(IASyncResultCallBack), currentclient);

    N 1 Reply Last reply
    0
    • S snouto

      i have a server and client networked application , each time i test them , gives me an error "Unable to read data from the transport connection: The I/O operation has been aborted because of either a thread exit or an application request. " Here is the code for the client , knowing that the server doesn't disconnect the current client , the server still see the client as connected the client code as follows : void RunClient() { try { IPAddress ip = IPAddress.Parse("127.0.0.1"); int port = 5079; IPEndPoint ipendpoint = new IPEndPoint(ip, 5079); //create the tcp client client = new TcpClient(); client.Connect(ipendpoint); Console.WriteLine("The Client has been Connected Successfully"); //begin Reading lock (client.GetStream()) { (client.GetStream()).BeginRead(data, 0, data.Length, new AsyncCallback(IASyncResultCallBack), client); } } catch (Exception s) { this.Invoke(new SetText(SetTextMethod), new object[] { s.Message }); } } void IASyncResultCallBack(IAsyncResult ar) { try { //get the tcp client instance TcpClient currentclient = ar.AsyncState as TcpClient; if (currentclient != null) { if (currentclient.GetStream().CanRead) { //get the instance of the data int count = (currentclient.GetStream()).EndRead(ar); if (count <= 0) { //disconnect the current client currentclient.Close(); currentclient = null; GC.Collect(); return; } //build the Received Text ReadText(data, 0, data.Length); } } //now begin Reading again lock (currentclient.GetStream()) { currentclient.GetStream().BeginRead(data, 0, data.Length, new AsyncCallback(IASyncResultCallBack), currentclient);

      N Offline
      N Offline
      Nagy Vilmos
      wrote on last edited by
      #2

      There's an amazing website that might help. It's called GOOGLE: Results 1 - 10 of about 4,310 for Unable to read data from the transport connection: The I/O operation has been aborted because of either a thread exit or an application request. with Safesearch on. (0.24 seconds) :mad:


      Panic, Chaos, Destruction. My work here is done.

      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