Error: nodename nor servname provided, or not known (python sockets)

From the docs of socket.gethostname: Return a string containing the hostname of the machine where the Python interpreter is currently executing. Note: gethostname() doesn’t always return the fully qualified domain name; use getfqdn() for that. The host IP is not the same as the hostname. You have a couple of options: You can either manually assign host to 0.0.0.0 or localhost You can also query socket.gethostbyname:host … Read more

Understanding INADDR_ANY for socket programming

bind() of INADDR_ANY does NOT “generate a random IP”. It binds the socket to all available interfaces. For a server, you typically want to bind to all interfaces – not just “localhost”. If you wish to bind your socket to localhost only, the syntax would be my_sockaddress.sin_addr.s_addr = inet_addr(“127.0.0.1”);, then call bind(my_socket, (SOCKADDR *) &my_sockaddr, …). As it happens, INADDR_ANY is a constant that happens … Read more

How to create PPTP connection with Java?

I need to check what accounts from my huge list are still valid on VPN-server, but I haven’t found any information on how to do it with Java language. How do I connect to PPTP-server using Java? I created a socket with the server ip and PPTP-port, just like this, according to PPTP working over … Read more

C++ network programming

To understand sockets and use them right, you need The Sockets Bible: W. Richard Stevens, Unix Network Programming, Volume 1: The Sockets Networking API (3rd Edition) You absolutely must have this book before you sit down to write a line of sockets code. Don’t leave home without it. Really. Starting around $35 used at Amazon. EDIT: The OP asked about … Read more

Does connect() block for TCP socket?

There’s hardly any “immediately” regarding networking, stuff can be lost on the way, and an operation that should be performed immediately in theory might not do so in practice, and in any case there’s the end to end transmission time. However connect() on a TCP socket is a blocking operation unless the socket descriptor is … Read more

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