Question: When I'm trying to set up a socket server, I've got an error message:

```
Exception in thread "main" java.net.BindException: Cannot assign requested address: JVM_Bind
    at java.net.PlainSocketImpl.socketBind(Native Method)
    at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:383)
    at java.net.ServerSocket.bind(ServerSocket.java:328)
    at java.net.ServerSocket.<init>(ServerSocket.java:194)
    at java.net.ServerSocket.<init>(ServerSocket.java:106)
    at socketyserver.SocketyServer.main(SocketyServer.java:12)
Java Result: 1

```

Whole code is simplest as it can be:

```
public static void main(String[] args) throws UnknownHostException, IOException
{
    ServerSocket serverSocket;
    serverSocket = new ServerSocket(9999);
}

```

I'm 100% sure that my ports are forwarded, Windows Firewall is off. Nothing blocks port 9999. What else can go wrong?

Answer: 
if your are using server, there's "public network IP" and "internal network IP".
Use the "internal network IP" in your file /etc/hosts and "public network IP" in your code.
if you use "public network IP" in your file /etc/hosts then you will get this error.
In my case:
Just **restarted my computer** and everything works fine after that.