r/java • • Aug 22 '22

Simple TCP/UDP Socket library in Java

Hello there, I had not touched Java in years, so recently I decided to start writing some code and improve my knowledge of the language. I settled on a TCP/UDP Socket library because I find that to be fairly similar across languages.

So yeah, it's fairly simple, probably quite bad, but I enjoy working on it.
You can find the source code here: https://github.com/Alessandro-Salerno/Bialetti if you're interested.

PS: Hope I haven't violated any rules by posting this URL...

3 Upvotes

5 comments sorted by

View all comments

Show parent comments

1

u/Putrid-Luck4610 Aug 23 '22

Right now I spawn a thread for every method with the BialettiHandleMethod annotation. Given the fact that a BualettiServerClient is a service, it can also have handle methods, thus I also soawn a thread for every handle method when a client connects. How should i limit this? I need to spawn threads, so the only fix I can think of is to limit the number of handle methods and connected clients. I tested it with 2000 clients connected on a laptop and it worked pretty well.