Is the IP address of different application processes the same on the same computer?

such as the title
or can it be different, using different network cards is different? You can still change

Dec.22,2021

generally speaking, there can be many network device interfaces on the same computer. For example, each network card (virtual or physical) can correspond to a network device interface, which can be seen through ifconfig on Linux, such as eth0/en0/tun0.. These are the packets of different network devices that are transmitted through different device interfaces. Two different devices may correspond to two different ip addresses.

In addition, something called a routing table is configured on the computer, which can be viewed and configured on the linux via the command route. This routing table determines which device is required to access an address or accept data from an address.

then go back to the process, if the process does not have special settings, then it will decide which device to use according to the routing table, which determines what the ip address is. However, in the code of a process, you can also use many means to specify this thing, just as you can also specify a different proxy server to access the same address in a process, then you can also get different ip addresses.


To put it simply, for each host, there is only one ip per subnet. Different applications can distinguish / communicate with each other through different ports (numbers).
there are some special cases. For example, docker, may have an ip, for each container on the host. In this case, instead of having multiple ip, the host should be treated as a subnet. Each container in this subnet is a (virtual) host.
also has some special-purpose ip, such as the most common loopback address 127.0.0.1 (note that it is not the localhost, in hosts that is not called, but it is written to hosts by default, so it jumps to 127.0.0.1 when typing "localhost" in the system, but it is not the default convention). This is a special convention in ip, including a 0.0.0.0 in linux, which is also common, and this should not be regarded as the second ip,. Or you can think of them as ip that means "yourself".
in short, there is only one ip per host in each regional network, because it represents the host in this subnet. The host will have different ip, corresponding to different networks. For example, if your computer is connected to the WiFi, at home, it will have an internal network address assigned to it by DHCP (such as 192.168.x.x). If it connects to the Internet, talks about Wechat, talks about QQ and plays games, there will be an external network address corresponding to it, which is probably what it means.

For more complex concepts, check out the TCP/IP protocol family, such as "schematic TCP/IP".


usually, only one IP,ip represents your computer.

Network layer: if you need to communicate with remote devices, it is addressed through IP.

Transport layer: establish impassable TCP or UDP sessions, and different processes are distinguished by port numbers.


you can have more than one ip, on the same computer, but ip has nothing to do with the process. You can get all the ip addresses of the host in programming

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b38436-2c108.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b38436-2c108.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?