Hey Guys,
Was wondering if anyone here is able to help. I have a TwitchBot that is written in C++ with winsock2. It used to work fine, and recently picked it back up and have noticed some strange issues with it.
At first the application was just hanging on the recv() call which is blocking, which seemed normal. However, it wasn’t responding to Twitch Chat after some time, and just hung on the recv() call indefinitely.
So, implemented a timeout using the following:
DWORD timeout = 300000; /* 5 Min Timeout */
int iResult = setsockopt(m_twitchSocket, SOL_SOCKET, SO_RCVTIMEO, (char*)&timeout, sizeof(timeout));
And then ping the server if the command times out and I’ve noticed I’ve been getting this error back sometimes:
Bytes Sent: 6
PING
SocketHandler::sendMessage: send failed with error: 10054
Which after looking up on the winsock reference it’s a WSAECONNRESET, which claims the connection was closed by the other side. Does anyone know what causes this issue and why Twitch would be closing the connection to my bot?
I’ve looked through the documentation and it doesn’t look like I’m missing or breaking any of the conventions there. There’s the message limit, but I can have the bot not send any messages and it will still hit the problem.
Thanks,