sin_addr is the IP address in the socket (the socket structure also contains other data, such as a port). The type of sin_addr is a union, so it can be accessed in three different ways : as s_un_b (four 1-byte integers), s_un_w (two 2-bytes integers) or as s_addr (one 4-bytes integer).
inet_addr converts an IPv4 address from a string in dotted decimal representation to an integer. This function is deprecated because it does not support IPv6, use inet_pton instead.
So basically, the line about which you are asking loads into the socket the IP address 127.0.0.1, meaning the local host.
Related Posts:
- What does “connection reset by peer” mean?
- What is AF_INET, and why do I need it?
- C++ network programming
- Python [Errno 98] Address already in use
- Will setting a multicast destination address to FFFF.FFFF.FFFF make it a broadcast?
- How to create PPTP connection with Java?
- What’s causing my java.net.SocketException: Connection reset?
- Android – could not install *smartsocket* listener
- Python ConnectionRefusedError: [Errno 61] Connection refused
- java.net.SocketException: Network is unreachable: connect
- Getting the IP address of the current machine using Java
- java.net.SocketException: Software caused connection abort: recv failed
- TypeError: ‘module’ object is not callable
- An existing connection was forcibly closed by the remote host
- What can be the reasons of connection refused errors?
- Chrome hangs after certain amount of data transfered – waiting for available socket
- How do I debug error ECONNRESET in Node.js?
- How do I debug error ECONNRESET in Node.js?
- Client on Node.js: Uncaught ReferenceError: require is not defined
- Client on Node.js: Uncaught ReferenceError: require is not defined
- Bad File Descriptor with Linux Socket write() Bad File Descriptor C
- Cannot assign requested address – possible causes?
- Connect: Socket operation on non-socket
- Connect: Socket operation on non-socket
- C# An established connection was aborted by the software in your host machine
- Cannot assign requested address – possible causes?
- connect Error: “No route to host”
- An attempt was made to access a socket in a way forbidden by its access permissions
- Only one usage of each socket address (protocol/network address/port) is normally permitted?
- Socket Programming in C++
- gaierror: [Errno 8] nodename nor servname provided, or not known (with macOS Sierra)
- Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)
- Program received signal SIGPIPE, Broken pipe
- Does connect() block for TCP socket?
- What is the difference between a port and a socket?
- Python [Errno 98] Address already in use
- How to fix java.net.SocketException: Broken pipe?
- Understanding INADDR_ANY for socket programming
- Error: nodename nor servname provided, or not known (python sockets)
- gaierror: [Errno 8] nodename nor servname provided, or not known (with macOS Sierra)
- Why does .Net Socket.Disconnect take two minutes?
- java.net.SocketTimeoutException: Read timed out under Tomcat
- Socket API or library for C++?
- What can cause a “Resource temporarily unavailable” on sock send() command
- java.net.SocketException: Connection reset
- What does socket binding mean?
- mysqld_safe Directory ‘/var/run/mysqld’ for UNIX socket file don’t exists
- Cannot assign requested address using ServerSocket.socketBind
- Bind failed: Address already in use
- Python socket.error: [Errno 111] Connection refused
- JS file gets a net::ERR_ABORTED 404 (Not Found)
- python socket programming OSError: [WinError 10038] an operation was attempted on something that is not a socket
- Sending string via socket (python)
- Why is my method undefined for the type object?
- Getting “socket.error: [Errno 61] Connection refused” python paramiko
- Errno 10061 : No connection could be made because the target machine actively refused it ( client – server )
- WSACancelBlockingCall exception
- MAMP “Apache couldn’t be started because port is in use.” AND “Can’t connect to local MySQL server through /tmp/mysql.sock
- Where to find the complete definition of off_t type?
- How to set timeout on python’s socket recv method?
- Python Socket Receive Large Amount of Data
- UDP Client/Server Socket in Python
- What is the reason and how to avoid the [FIN, ACK] , [RST] and [RST, ACK]
- Exception in thread “main” java.net.ConnectException: Connection refused: connect Socket Programming Java
- Socket.Select returns error “An operation was attempted on something that is not a socket”
- Java simple code: java.net.SocketException: Unexpected end of file from server
- adb socket not working and daemon
- Handling a timeout error in python sockets
- Python Socket Multiple Clients
- Reasoning behind C sockets sockaddr and sockaddr_storage
- Official reasons for “Software caused connection abort: socket write error”
- Using sys/socket.h functions on windows