areong / socket Goto Github PK
View Code? Open in Web Editor NEWThreaded Java socket server and client
License: MIT License
Threaded Java socket server and client
License: MIT License
借用这个插件的时候,客户端和服务端分离,当服务端一直运行时,当每次新建一个客户端socket时,就会产生一个监听,然后监听一个连接,这样使用就会出现cpu使用100%的情况,使用jstack查了一下堆栈信息,发现监听线程和BufferedReader一直阻塞。然后我在BufferedReader接收消息然后回复后就马上关掉它,暂时保证CPU使用没有达到100%
(Related pull request: #6)
#3 and #4 report 100% CPU usage when SocketServer
is listening to connections. This phenomenon should not happen. The phenomenon is probably caused by that the SocketServer
keeps listening after a client is connected.
Let the user decide how many connections a SocketServer
is going to listen. Once the specified number of clients connected, the SocketServer
stops listening.
SocketServer
only listen to a specified number of connections.Close the corresponding connection thread once the connected client is closed. Also remove the closed connection thread from the list.
Socket.isClosed()
will not be true
until Socket.close()
is called. That is, even the connected endpoint closes its socket, Socket.isClosed()
on this side still returns false
before Socket.close()
is called.Socket.isConnected()
is true
after it is connected to another endpoint. It will still be true
when the other endpoint closes.ConnectionThread
s.希望areong可以修复一下!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.