Lab 10: Networking
- Review Lecture 11.
- Log in to a computer that is running Linux and connected to the Intraweb.
- Create an empty directory named
javalab10/
in your
directory.
- Open Kate and change to the
javalab10/
directory.
- Retrieve a web page by telnetting to the HTTP port.
- At the Kate shell prompt, type:
- Carefully type the following without pressing backspace or making
a mistake:
- Press enter two times. You should then see the HTML of the page displayed.
- Repeat the exercise but redirect the output to a file and then view
the file:
- telnet home.umu.ac.ug 80 > test1.txt
- GET /index.html HTTP/1.0
- more test1.txt
- Repeat but request only the header.
- telnet home.umu.ac.ug 80 > test2.txt
- HEAD /index.html HTTP/1.0
- Repeat but use a file that is not on the server.
- telnet home.umu.ac.ug 80 > test3.txt
- GET /badfile.html HTTP/1.0
- Repeat but use the command HELLO instead of GET.
- telnet home.umu.ac.ug 80 > test4.txt
- Retrieve a web page using a Java web client that uses stream sockets.
- Copy WebGet.java to your
folder, open the source in Kate, and compile it.
- To run the program, type:
- java WebGet home.umu.ac.ug index.html > test5.txt
- Repeat but use a file that is not on the server:
- java WebGet home.umu.ac.ug badfile.html > test6.txt
- Retrieve a web page using a Java web client that uses a URL connection.
- Copy URLGet.java to your
folder, open the source in Kate, and compile it.
- To run the program, type:
- java URLGet http://home.umu.ac.ug/os/index.html > test7.txt
- Repeat but use a file that is not on the server:
- java URLGet http://home.umu.ac.ug/badfile.html > test8.txt
- Compress the folder using the Ark archiving program to produce
javalab10.zip
.
- Send the
javalab10.zip
file to gvogl@umu.ac.ug as an attachment in a message
with subject java lab 10.