I've been trying to connect a socket client with a URL. Am I supposed to add the URL's IP in the Windows host
file ("C:\Windows\System32\drivers\etc\hosts"
)?
What is socket?
Sockets allow communication between two different processes on the same or different machines. To be more precise, it's a way to talk to other computers using standard Unix file descriptors. In Unix, every I/O action is done by writing or reading a file descriptor. A file descriptor is just an integer associated with an open file and it can be a network connection, a text file, a terminal, or something else.
But I've got this error:
java.net.UnknownHostException: https://socket.edu.net
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "java.io.DataInputStream.readLine()" because "this.input" is null