I have a very basic understanding of clients, servers, sockets, input and output streams, etc. related to having servers. However, my socket that I created does not seem to work. I used many unused ip and ports, and even tried my own computer's ip. The Socket I created does not throw an IOException, or break anything. Anything past the creation of my socket object never happens.
public class ClientHello {
public static void main(String [] args) {
String ip = "91.202.240.208";
int port = 51678;
try {
System.out.println("1");
Socket sock = new Socket(ip, port);
System.out.println("2");
DataOutputStream stream1 = (DataOutputStream) sock.getOutputStream();
stream1.writeUTF("Hi server!");
DataInputStream stream2 = (DataInputStream) sock.getInputStream();
System.out.println(stream2.readUTF());
sock.close();
}catch(IOException e) {
e.printStackTrace();
}
}
}
Additionally, the ip and port is from a random Ukrainian thingy.