IP address
127.0.0.1A network address. Here it refers to this same PC.
See how the operating system connects processes to TCP, UDP and port numbers.
Δες πώς το λειτουργικό σύστημα συνδέει τις διεργασίες με το TCP, το UDP και τα port numbers.
Hover or focus for GreekThe operating system manages CPU time, memory, files and devices. Ordinary applications run in user space. The kernel executes privileged operations and controls critical resources.
Το λειτουργικό σύστημα οργανώνει CPU, μνήμη, αρχεία και συσκευές. Οι συνηθισμένες εφαρμογές εκτελούνται στο User Space. Ο kernel εκτελεί προνομιούχες λειτουργίες και ελέγχει κρίσιμους πόρους.
Hover or focus for GreekPython calls send() on its socket.
The TCP/IP stack manages the socket, buffers and packets.
The network adapter handles transmission. For localhost, the path stays inside the OS.
Simplified Windows/Linux model. The spaces represent protection and access, not two separate computers. Library/API calls may use system calls.
A process is a running instance of a program with its own state and resources. The OS assigns it a process ID. An application such as Firefox may use several processes.
Μια διεργασία είναι μια εκτέλεση προγράμματος με δική της κατάσταση και πόρους. Το OS της δίνει έναν Process ID (PID). Μια εφαρμογή, όπως ο Firefox, μπορεί να χρησιμοποιεί πολλές διεργασίες.
Hover or focus for GreekPID values are illustrative. These buttons change only this example.
| Program | PID | State | Action |
|---|
Each active process has its own PID within this OS.
After a process ends, the OS may reuse its PID later. Two different PCs can have the same PID at the same time.
An application requests a socket from the OS and uses a handle or file descriptor to access it. The kernel keeps its state and buffers. One process may use many sockets.
Η εφαρμογή ζητά ένα socket από το λειτουργικό και το χρησιμοποιεί μέσω ενός handle ή file descriptor. Ο kernel διατηρεί την κατάσταση και τα buffers του. Μία διεργασία μπορεί να χρησιμοποιεί πολλά sockets.
Hover or focus for GreekPython server · PID 4100
# The server does not have a socket yet
S1 and S2 are symbolic socket names, not port numbers.
Select Next step to let Python request a TCP socket.
IP supplies a network address. Ports are 16-bit fields in TCP/UDP headers. The OS uses endpoint information to find a socket. A PID identifies a process inside the OS and is not carried in the TCP/UDP header.
Η IP δίνει διεύθυνση δικτύου. Τα ports είναι αριθμοί 16 bit στις επικεφαλίδες TCP/UDP. Το OS χρησιμοποιεί τα στοιχεία των άκρων για να βρει socket. Το PID αναγνωρίζει τη διεργασία μέσα στο OS και δεν βρίσκεται στην επικεφαλίδα TCP/UDP.
Hover or focus for Greek127.0.0.1A network address. Here it refers to this same PC.
8000 / TCPPart of the information identifying a communication endpoint.
PID 4100A process identifier local to the OS.
In this TCP example, the connection to port 8000 has already completed its handshake.
| Socket | Local endpoint | Process |
|---|---|---|
| S2 | TCP :8000 | Server PID 4100 |
| U1 | UDP :8000 | Telemetry PID 6200 |
S2 has remote endpoint 127.0.0.1:62609. Listening socket S1 (also TCP :8000, see Section 05) is omitted here: a new connection request (SYN) to port 8000 would be matched to S1, while data on this established connection is matched to S2. There is no socket for port 9000 in this example.
Try TCP and UDP with the same destination port, 8000.
A TCP connection is distinguished by source IP, source port, destination IP and destination port. UDP has a separate port space and different matching rules. Here we use a simple case with one receiver per protocol.
Port values range from 0 to 65535. In many bind() calls, a value of 0 asks the OS to choose a port automatically.
A server creates a listening socket. For each accepted connection, accept() returns a new socket. The listening socket keeps waiting and the server port remains 8000.
Ο server δημιουργεί ένα listening socket. Για κάθε αποδεκτή σύνδεση, το accept() επιστρέφει ένα νέο socket. Το listening socket συνεχίζει να περιμένει και το server port παραμένει 8000.
Hover or focus for GreekLocal endpoint: 127.0.0.1:8000 · waiting for new connection requests
| New server socket | Client endpoint | Server endpoint |
|---|---|---|
| No established connection yet. | ||
Connect two clients and compare their ports.
Client ports here are consecutive for readability. Real systems pick temporary (ephemeral) ports with randomization: Windows uses 49152–65535 by default and Linux 32768–60999, so your own captures will show different numbers.
A connection with reliable, ordered delivery of a byte stream. One send() does not necessarily correspond to one recv(). The application defines the boundaries of its own messages.
Separate datagrams without a TCP handshake. A UDP socket can receive messages from multiple senders, usually with recvfrom(). UDP does not guarantee delivery or ordering.
UDP also has a connect() API, without a TCP handshake.
Client and server can run on the same PC. Both endpoints use 127.0.0.1 but different ports. HTTP is the application data carried by TCP.
Ο client και ο server μπορούν να βρίσκονται στο ίδιο PC. Και τα δύο άκρα έχουν IP 127.0.0.1, αλλά διαφορετικά ports. Το HTTP είναι τα δεδομένα της εφαρμογής που μεταφέρει το TCP.
Hover or focus for GreekMove through the steps. PIDs do not appear in network header fields.
Teaching sequence. A real capture may combine data and flags into a different number of packets, and it will also show FIN/ACK segments when the connection closes. A TCP ACK acknowledges bytes, not whether the file exists.
Wireshark shows addresses, ports and data. OS tools show which process owns the connection. Combine these two views while the Python server is running.
Το Wireshark δείχνει διευθύνσεις, ports και δεδομένα. Τα εργαλεία του OS δείχνουν ποια διεργασία χρησιμοποιεί τη σύνδεση. Συνδύασε τις δύο όψεις με ενεργό τον Python server.
Hover or focus for GreekFor the localhost kit, capture on the Adapter for loopback traffic capture.
tcp.port == 8000
Find the destination port in the GET and the source port in the response.
Get-NetTCPConnection -LocalPort 8000
Note the OwningProcess and substitute its number for <PID>:
Get-Process -Id <PID>
-LocalPort 8000 lists the server side, so OwningProcess is the server's PID. To find the client process, use Get-NetTCPConnection -RemotePort 8000.