Executing client and server

First, we start server execution with the echo_server_ipv6.py Python script. After executing this script, the server it will wait for connections:

usage: echo_server_ipv6.py [-h] --port PORT

When executing the server script, we must use the port argument to establish the number where the server is listening for connections:

python echo_server_ipv6.py --port 7575
Waiting connections in ::1:7575

Next, we start the client with the same port parameter:

python echo_client_ipv6.py --port 7575
Connected to the server --->::1:7575
Send data to server: Hello from ipv6 client
Write your message >

And we will see that the server has already identified the connection:

Connected to ('::1', 3210, 0, 0)
Received data from the client: [Hello from ipv6 client]
Sent data echoed back to the client: [Hello from ipv6 client]

Now we can write any message on the client, and in the server log we can verify that the message is sent:

Received data from the client: [Hello from ipv6 client]
Sent data echoed back to the client: [Hello from ipv6 client]
Received data from the client: [This is a new message]
Sent data echoed back to the client: [This is a new message]

In this screenshot, we can see the execution in the socket server:

In this screenshot, we can see the execution in the socket client:

Upon receiving the exit message, the server will close the connection. The client has also received an exit message and will also close the connection.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset