CMPSCI 453 591
Computer Networking
Fall 2005
Professor Jim Kurose

Programming Assignment 1

Questions and Answers



Q: Do you know what this error means?  I get it once in a while when I try to run my server
    Exception in thread "main" java.net.BindException: Address in use: bind
        at java.net.PlainSocketImpl.socketBind(Native Method)
       at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:397)
        at java.net.ServerSocket.<init>(ServerSocket.java:172)
        at Server.main(Server.java, Compiled Code)
A: The error message indicates that the port number that your server is trying to use for a socket it is trying to create (almost certainly the welcoming socket your code is creating) is already "in use".  This means that the port number could actually be allocated to another process in the system (e.g., another student has chosen that port number for their server or client that is currently running).  Another cause of this error message may be what your server did the last time it was executing.  For example, if your server abruptly terminating without closing the welcoming socket, or if it hung, the port number it was using may not yet have been marked as "available" by the operating system.  So even though you think the port is available, the operating system is not yet aware of that fact.
There are several things you can/should do:

Q: Is it acceptable to do the first programming assignment in C# (also, what about python)
A: Absolutely, but you'll have to do a bit of work digging up the socket API for C# on your own (same for python)

Q: .. it seems Ive gotten the relay/receiver to work without knowing how many bytes on an incoming string, all I do is just keep reading the the line until it equals null. It seems to work fine.
A: "seems to" is right but how does the revceiver actuallyknow whether or not the sender has finished sending the message! The sender need to explicitly let the receiver know how many bytes are in the applicaiton-layer message.

Q: In the description of the sender process you state "Note that because of the btye-stream semantics of the TCP socket, your sender process will need to define a application-layer DATA message that lets the relay process know how many characters are in the incoming byte stream." I'm slightly confused here. Since we are dealing with character strings why can't i set up a PrintWriter (for output to relay) and BufferedReader (for input from Relay) and use println() and readLine() to send strings back and forth?
A: Good question. I guess that might work OK for a single line. But what would happen if the line you wanted to send itself contained a CR-LF that was part of the message itself. I think that would cause the BufferedReader to cease reading after the embeded CR-LF

Q: On the assignment webpage, you say "Please read the information posted on the class WWW site about what to hand with your assignment." However, I am unable to find on your website this page. I may in fact be losing my mind, and it is right there, but I cannot find it. Is it hiding somewhere in the open, or am I just looking in the wrong place? I guess my question is: What are we suposed to hand in?
A: Sorry it's probably not that obvious, but the information about what to hand in is in http://www-net.cs.umass.edu/cs453/grading.html