-3

I'm making a twitch bot which gets requests via chat and loads a youtube player via JWebBrowser from the requested link, but when i close the application i get a socket exception (Unless i remove the component used to display the JWebBrowser component). This is the stacktrace:

java.net.SocketException: Connection reset
    at java.net.SocketInputStream.read(Unknown Source)
    at java.net.SocketInputStream.read(Unknown Source)
    at java.io.BufferedInputStream.fill(Unknown Source)
    at java.io.BufferedInputStream.read(Unknown Source)
    at java.io.ObjectInputStream$PeekInputStream.peek(Unknown Source)
    at java.io.ObjectInputStream$BlockDataInputStream.peek(Unknown Source)
    at java.io.ObjectInputStream$BlockDataInputStream.peekByte(Unknown Source)
    at java.io.ObjectInputStream.readObject0(Unknown Source)
    at java.io.ObjectInputStream.readUnshared(Unknown Source)
    at chrriis.dj.nativeswing.swtimpl.core.OutProcessSocketsMessagingInterface.readMessageFromChannel(OutProcessSocketsMessagingInterface.java:116)
    at chrriis.dj.nativeswing.swtimpl.core.MessagingInterface$2.run(MessagingInterface.java:392)

I have no idea what do in order to solve the issue that is causing this exception to be thrown. Thanks.

  • 1
    You'll need to show us your code where the error is occuring (OutProcessSocketsMessagingInterface.java:116). – Steve Smith Mar 10 '17 at 16:56
  • I sadly can't provide you with that line as it's from an external library i'm using to access twitch chat (basically it gets link requests from the chat and plays a video on my software), but i don't think there's any problem in it, rather i doubt my programming but i have no idea where to look in my code.. – Ramzah Beoulve Mar 10 '17 at 17:03

1 Answers1

0

This Exception is your friend. In short, it's the mechanism in which the thread that is blocked on the read(...) call gets freed up when the socket is closed.

ControlAltDel
  • 33,923
  • 10
  • 53
  • 80