Socket won't close after program is terminated
My socket won't close after my program is terminated regardless of if I use the .close method or not.
16 Replies
Hey, @Kar.Jar!
Please remember to
/close
this post once your question has been answered!Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Pastebin
Server Class - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin
Client Class - Pastebin.com
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
the gist of the program is that it takes in console input in the Client class and sends the message to the server and outputs a different message with the date.
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
so basically the socket won't close
the server object I created in the main method
it has a ServerSocket object field
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
a bind exception
the ServerSocket is creating a connection but it's not killing it once the program ends
so I can't use the same port if I end the program unexpectedly without a Bind Exception
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
wdym
I'm using try with resources, I wanted to avoid using that with the SocketServer because I want to keep it as an instance variable
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
where
can you show specifically?
everything besides the ServerSocket that is reading and writing is implicitly closed with try-with-resources
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
all good this has been a real pain but there is probably a simple fix
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View