02. Socket programming
Using nc:
nc host port — connect via TCP (client):
$ nc www.ru 80 GET / HTTP/1.0
Response:HTTP/1.1 302 Moved Temporarily Server: nginx/1.5.7 Date: Fri, 17 Apr 2020 15:10:08 GMT Content-Type: text/html Connection: close Location: http://217.112.42.66/404 <html> <head><title>302 Found</title></head> <body bgcolor="white"> <center><h1>302 Found</h1></center> <hr><center>nginx/1.5.7</center> </body> </html>
nc -l port — listen to port (server)
nc -l 1234 from one terminal
nc 127.0.0.1 1234 from other is a selfish chat
127.0.0.1 is the address of loopback interface (connecting to the same computer)
Tasks:
Make work all lectture examples
NB: when trying TCP server, use appropriate port not no mess with others
- At sugon server you can invent unused port number by using your UID: 11058 will do
H/W
TODO