Bot gets disconnected due to "An established connection was aborted by the software in your host machine"

Hey everyone,

I am part of the BetaDwarf developer team and at the moment we are doing an event where we whisper a twitch user when a criteria has been met.

It works some times and when it does not work it results in this exception “An established connection was aborted by the software in your host machine”.

Does anyone have an idea why?

Group Chat was broken/misbehaving about the time of this post and should be working fine now.

Hey BarryCarlyon,

This is unfortunately still an issue. Can I provide you with more information of sorts?

Often this is actually you not pulling messages off quickly enough, where the queued messages exceed ~20. You might try checking to make sure you’re not blocking your listener thread.


I should be pulling off messages every 100ms unless something is wrong.

Xangold just wrote me on Skype and asked:
Is the symptom that you get disconneted randomly? And how often does it occur? Also whether I answer the PING requests, which I do by replacing PING with PONG when I get a PING message.

Since it is a system that whispers depending on various criteria it is difficult to say whether it is random. Also the fact that I haven’t looked closely at the data, since it is scattered a bit. Anyways, it seems to happen more than once per hour and we whisper in average 9 times an hour.

Is there a reason you do not pull them off immediately? Chat servers will kill a very slow connection where we have queued messages, as tournymasterbotCurse mentioned.

I did not think it was necessary to do it any faster. I should mention that 100ms is the worst case scenario. It should do it once every 50ms.

Based on the error message, are you using c#? One solution would be to use async wait for data so it instantly pulls it off the queue, doesn’t use 100% cpu, and doesn’t require Thread.Sleep()

If that could be the issue I can try it the next time we update our servers (probably within 24 hours). Right now we do not use the whisper due to this issue, so we show the reward on the screen instead, but I will keep you updated.

It depends on the velocity of messages your connection has to receive. I’d recommend when receiving a message, immediately push it to an asynchronous queue so that it does not block reading other messages. A buildup can cause a disconnect.

Are others reading this thread seeing similar issues?

It seems I rarely receive any messages though. Only the PING once in a while.

You need to send CAP REQ in order to receive whispers over that connection.

Yes, I know, but we do not need them for the current implementation. Could that be the problem?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.