public static void main(String[] args) {
ServerSocket server_socket = null;
ServerSocket server_socket2 = null;
Socket command_socket = null;
Socket file_socket = null;
try {
server_socket = new ServerSocket(1234);
server_socket.setReuseAddress(true);
while (true) {
command_socket = server_socket.accept();
System.out.println("Connection established with a client with the address: "
+ command_socket.getRemoteSocketAddress());
ServerThread st = new ServerThread(command_socket);
new Thread(st).run();
server_socket2 = new ServerSocket(6942);
server_socket2.setReuseAddress(true);
file_socket = server_socket2.accept();
new Thread(st).run();
System.out.println("Connection established with a client with the address: "
+ file_socket.getRemoteSocketAddress()); ...
I have this code, I want to create a new socket to transfer data and use the first socket as a command socket. However, My second socket does not work. It does not print the second connection. How can I make it possible to use 2 sockets? Thanks...