An IP address is used to uniquely identify a computer on a network. Within a network comprising multiple smaller networks and numerous hosts, if host PC1 needs to send information to host PC2, PC1 must be able to locate PC2 within the network. This requires PC2 to have a unique identifier across the entire network. This unique identifier for each host on the network is the IP address. Example: 192.168.1.100
An IP address can identify a host within a network, but to identify a specific process within that host, a port number is also required. In computer networks, a port number serves as a unique identifier for processes within a host. Therefore, when one process needs to send data to another process, it uses “IP address + port number” to identify the unique process within the network. Example: 50000
IP addresses are used to identify hosts on a network through a combination of network and host numbers. Hosts with the same network number are referred to as local network hosts, while hosts with different network numbers are considered remote network hosts. Hosts within the local network can directly communicate with each other. For hosts in remote networks to communicate with each other, data must be transmitted and forwarded through the local gateway.
To find out the network segment of an IP address, perform a bitwise AND operation between the IP address and the subnet mask. The result obtained represents the network segment of the IP address. If two IP addresses have the same network segment after the AND operation, they are in the same network segment.
IP: 192.168.1.100 Subnet Mask: 255.255.255.0
IP: 192.168.1.101 Subnet Mask: 255.255.255.0
After performing the AND operation on both IP addresses, the preserved segment is 192.168.1. Therefore, these two IPs are in the same network segment.
Note: There is no direct relationship between process IDs and port numbers. They represent completely different things.
A port number identifies which port a process is using for communication. Specific port numbers do indeed have common purposes: for instance, HTTP commonly uses port 80, and HTTPS uses port 443. However, a process can be assigned any PID, depending on its startup time. Multiple TCP connections can exist in one computer, and port numbers are used to distinguish these connections.
As the name suggests, a process ID (PID) is a numerical identifier for a process currently running on a computer. Typically, many processes are running concurrently—on Windows, you can view them by opening Task Manager and selecting Details.
Port numbers are associated with network connections. An IP address identifies a computer, while a port number identifies a service provided by that computer or accessed by it. For example, the port number is included in requests sent to servers, indicating which service the client wants to access. If a client uses port 80, it’s an HTTP request; port 443 is for HTTPS requests, port 21 is for FTP access, and so on.
Firewalls include port filtering, allowing specific ports (services) while blocking others.
In computer communication, if a device wants to communicate with another, it must provide its own IP address and port, allowing the other party to locate it. Setting the IP address as 0.0.0.0 means the current program listens on all bound IP addresses of the local machine.
For example, consider an industrial computer with two network cards: one connected to Device 1 with IP address 192.168.1.1 and the other to Device 2 with IP address 192.168.2.1. Network Card 1 has IP 192.168.1.100, and Network Card 2 has IP 192.168.2.100. The standard interface TCP SERVER is activated, with IP and port as 0.0.0.0:50000. This setup allows both Device 1 and Device 2 to use the service through their respective network card IPs, even though they are not on the same network. If the service is configured to use the network card IP of Device 2, 192.168.2.100, and the service only accepts data sent to this IP, Device 1 won’t be able to connect to the service. Therefore, everyone generally uses 0.0.0.0 by default, which is simpler and more widely understood.
On the client side, you need to enter the IP address and port of the device you want to connect to. In other words, fill in the details of the device you wish to connect to.