Socket input stream keeps closing or EOF Exception
This is a chunk of my Server class, i want the input stream to keep listening to the socket if other requests are called. But it keeps giving me error with the stacktrace:
Line 29 in server is :
19 Replies
⌛
This post has been reserved for your question.
Hey @Ed! Please useTIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here./close
or theClose Post
button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
what is the client code?
i think the issue is mainly from server side because its the one that keeps shutting down
Also, note that a single malicious client could completely take over your server
Yeah this is a primitive project for a class in uni just to demonstrate an idea i am going to build
but do you know why the server keeps crashing?
Or why do i keep reaching end of input
I think so
the client sends two request objects
but the server accepts such objects in a loop
it would expect infinitely many request objects
but the client just stops sending
it actually always stops after first request is recieved and response is sent
2nd request is never received by server for some reason
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
oh you are actually right...
Is there a way to just keep server up all time and deal with each request that he gets from as many clients as possible?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
its working now, but after 2 requests it crash with same error
How can i listen tho
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
can i do this without threads?
true while loop, with if serversockt.accept? then loop again until end
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
something like this
logically correct?
yeah thats probably what i am planning to do
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
yeah i fixed it its working now
Thanks a lot mate i really appreciate it!
If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
Post Closed
This post has been closed by <@351059014341099521>.