sanderdriesen / WhatsAPINet

A .NET WhatsApp API
32 stars 48 forks source link

SocketException An established connection was aborted by the software in your host machine #14

Closed sujeet-bhujbal closed 8 years ago

sujeet-bhujbal commented 8 years ago

Hi I have downloaded new Code and I am getting below error

SocketException An established connection was aborted by the software in your host machine at wa.SendMessage(tmpUser.GetFullJid(), line);

Please let me know

sanderdriesen commented 8 years ago

This is a very general exception that occurs when the connection is closed on whatever reason. Very common using sockets. Can you share more information about how you initialize WhatsApp and how you create the tmpUser? Does this error always occurs or sometimes?

sujeet-bhujbal commented 8 years ago

Hi Sanderdriesen, When ProcessChat method is invoked I am getting error at WhatsNetwork.cs Class while sending socket data

private void Socket_send(byte[] data) { if (this.socket != null && this.socket.Connected) { try {

                this.socket.Send(data);
            }
            catch (Exception)
            {

                throw;
            }
        }
        else
        {
            throw new ConnectionException("Socket not connected");
        }
    }

Please let me know why this is occur

janpieterz commented 8 years ago

@sujit9923 could you look at Sander's question and show us how you initialize WhatsApp? As Sander also said, this is a very generic error, so please look over your code and see if you keep the right things in memory and try to debug to see where the socket loses it's connection.

eaba commented 8 years ago

I am getting same issue......I am running my on Owin SelfHost on IIS...and also attempting create multiple instances of it...... i have also upgraded .net to 4.5..... Will it work for my scenario?

janpieterz commented 8 years ago

This should work. The issue is most likely with your local machines or firewalls tackling this. In case you find something structurally wrong please create an issue, otherwise use StackOverflow to ask questions on how to implement this right.