1 |
h08 |
CS56 F16 |
Name: | ||||
---|---|---|---|---|
(as it would appear on official course roster) | ||||
Umail address: | @umail.ucsb.edu | section 4pm, 5pm or 6pm |
||
Optional: name you wish to be called if different from name above. | ||||
Optional: name of "homework buddy" (leaving this blank signifies "I worked alone" |
h08: Threads and Sockets (Networking) (HFJ 15) (Gradescope submission)
ready? | assigned | due | points |
---|---|---|---|
true | Mon 10/10 12:30PM | Fri 10/14 08:00PM |
You may collaborate on this homework with AT MOST one person, an optional "homework buddy".
MAY ONLY BE TURNED IN IN THE LECTURE/LAB LISTED ABOVE AS THE DUE DATE,
OR IF APPLICABLE, SUBMITTED ON GRADESCOPE. There is NO MAKEUP for missed assignments;
in place of that, we drop the three lowest scores (if you have zeros, those are the three lowest scores.)
Please read HFJ Chapter 15, then answer these questions.
-
(10 pts) This assignment should be submitted by scanning the pages in the correct order to a PDF file and uploading to https://gradescope.com.
For more information, visit http://ucsb-cs56-pconrad.github.io and look for Gradescope: Student Self Submission under “topics”.
Even though it is a Gradescope submission, nevertheless, please fill in the information at the top of this homework sheet, including your name and umail address. Put the time your discussion section starts (4pm, 5pm or 6pm) in the space indicated (the one you are registered for—even if you usually attend a different one.)
If the other two items apply, please fill them in as well. Please do this every single time you submit homework for this class.
-
(10 pts) You are creating a socket by calling
new Socket("127.0.0.1",20000)
and you get aBindException
. What does this mean, and what should you do to try to fix this? (Hint: see the reading notes online at HFJ Chapter 15–linked to from the online version of this Homework assignment.) - What does it mean for a thread to be:
- (4 pts) new
- (4 pts) runnable
- (4 pts) running
- (4 pts) blocked
- Briefly describe the role of each of these in setting up communication over the network between two running Java programs
- (5 pts) an IP address
- (5 pts) a port number
- (10 pts) What puts a thread into the new state?
- (10 pts) What puts a thread into the runnable state?
- (10 pts) What puts a thread into the running state?
-
(4 pts) When you create a new thread which of these four states above does it go into? (circle one):
new runnable running blocked -
(4 pts) When you call the
.start()
method of a thread, which of the four states above does it go into? (circle one):new runnable running blocked - Give two examples of events that can move a thread into a blocked state.
- (3 pts)
- (3 pts)
-
Suppose you need to choose a port number to listen for connections on.
- (5 pts) What is the range of numbers that you should always avoid?
- (5 pts) What is the highest number that a port number can possibly be?