You know how you connect the socket with a try door
And send receive and send text messages to each other
It's natural that it's still available in the try statement, but I want to send it when I click the button, but I can't call up the sender receive function, but I can connect it again, but how do I usually use it? Static It's not possible, and I'm curious how it's usually done
java
The reason why the socket is difficult to handle is that the minimum multi-thread must be considered.
Blocking is basically a multi-threaded environment.
At this point, one thread works by checking the buffer reception with infinite repetition. Sending is called per event, and receiving creates a separate thread and treats it as an infinite loop.
This is a simple way to handle blocking sockets.
However, multi-threads can be a difficult topic, so prior learning is necessary.
© 2024 OneMinuteCode. All rights reserved.