okay I'm trying to use "ssh" local host 22 on my mac and for some reason it is saying this error ssh: connect to host localhost port 22: Connection refused
this is my code:
import java.io.IOException;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;
public class ServerMain {
public static void main(String[] args) {
int port = 22;
try {
ServerSocket serverSocker = new ServerSocket(port);
while (true) {
Socket clientSocket = serverSocker.accept();
OutputStream outputStream = clientSocket.getOutputStream();
outputStream.write("Hello World\n".getBytes());
clientSocket.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}