The invention discloses a socket
encryption communication method for a
server. The method comprises the steps of S1, starting a new thread and establishing a socket processor object of the
server according to a preset parameter; S2, establishing a
server socket
channel object, a server socket connection object and an event selector in the socket processor object; S3, registering for a
client connection request event for the server socket
channel object in the event selector; S4, starting the new thread, receiving the connection request event sent by a first
client, and establishing socket connection with the first
client; and S5, after the connection is successful, carrying out data interaction with the first client. The method has the beneficial effects that according to the technical scheme, a socket
channel object, a socket connection object and an SSL engine are generated for the client at the server, the socket connection is established with the client, and the data interaction is carried out with the client, so the data interaction speed and efficiency are improved, and the data interaction security is greatly improved.