02.1 Using an example code

This page allows to display client-server dialogues in parallel by including corresponded sections in a table.

Unix domain datagram server

02_Sockets$ ./unix_d_server u_socket







4d 65 73 73 61 67 65


Unix domain datagram client

02_Sockets$ ls
Makefile           tcp_echo_serverSR.c  unix_d_send.c   unix_d_server
tcp_client.c       tcp_qq_srver.c       unix_d_sendO    unix_d_server.c
tcp_echo_server.c  tcp_qq_srverS.c      unix_d_sendO.c  u_socket
02_Sockets$ ls -l u_socket
srwxr-xr-x 1 george george 0 апр 20 11:49 u_socket
02_Sockets$ ./unix_d_sendO u_socket Message


TCP counter server

02_Sockets$ ./tcp_qq_srver 127.0.0.1 1213


TCP client

02_Sockets$ ./tcp_client 127.0.0.1 1213
Connection 1!
02_Sockets$ ./tcp_client 127.0.0.1 1213
Connection 2!
02_Sockets$ ./tcp_client 127.0.0.1 1213
Connection 3!
02_Sockets$


TCP echo server 1

02_Sockets$ ip -4 address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    inet 127.0.0.1/8 scope host lo
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    inet 192.168.100.16/24 brd 192.168.100.255 scope global dynamic noprefixroute wlan0
02_Sockets$ ./tcp_echo_serverSR 0.0.0.0 2132
Received 9 bytes from 127.0.0.1, port 51874
Received 19 bytes from 192.168.100.16, port 33016


Local netcat client

02_Sockets$ nc 127.0.0.1 2132
loopback
loopback
02_Sockets$ nc 192.168.100.16 2132
local IPv4 address
local IPv4 address


TCP echo server 2

Received 20 bytes from 192.168.100.4, port 52282
Received 32 bytes from 192.168.100.4, port 12345


Remote netcat client

remote_host$ nc 192.168.100.16 2132
Remote IPv4 address
Remote IPv4 address
remote_host$ nc -p 12345 192.168.100.16 2132
Remote IPv4 address with specific client port
Remote IPv4 address with specifi


HSE/ArchitectureOS/02_SocketProgramming/CommandlineExamples (последним исправлял пользователь FrBrGeorge 2020-04-20 16:07:47)