What is the difference between 127.0.0.1 and localhost

Well, the most likely difference is that you still have to do an actual lookup of localhost somewhere. If you use 127.0.0.1, then (intelligent) software will just turn that directly into an IP address and use it. Some implementations of gethostbyname will detect the dotted format (and presumably the equivalent IPv6 format) and not do … Read more

How to find an available port?

If you don’t mind the port used, specify a port of 0 to the ServerSocket constructor and it will listen on any free port. ServerSocket s = new ServerSocket(0); System.out.println(“listening on port: ” + s.getLocalPort()); If you want to use a specific set of ports, then the easiest way is probably to iterate through them … Read more

What is the difference between connection and read timeout for sockets?

What is the difference between connection and read timeout for sockets? The connection timeout is the timeout in making the initial connection; i.e. completing the TCP connection handshake. The read timeout is the timeout on waiting to read data1. If the server (or network) fails to deliver any data <timeout> seconds after the client makes … Read more

An existing connection was forcibly closed by the remote host

This generally means that the remote side closed the connection (usually by sending a TCP/IP RST packet). If you’re working with a third-party application, the likely causes are: You are sending malformed data to the application (which could include sending an HTTPS request to an HTTP server) The network link between the client and server … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)