NOTES ON PROGRAMMING ASSIGNMENT 2:

Get the REVISED notes in text form here

Get zipfile of REVISED testcode here - (Further revised 3/30/2007) Note: This one fixes the bytecount problem for sender and receiver NAMES

When sending or receiving UDP or TCP packets, you need to allocate byte buffers to contain messages. We are using the convention of 1024 byte buffers as an upper limit. Make sure your buffers can be as big as 1024 for receiving a messasge. Also make sure you never send a packet that is bigger than 1024 bytes.

We have created a test stub to help you debug your program. The commandline is as follows:

  • java testStub -p1 [Listenning Port for Conn] -p2 [Listenning Port for ConnLess]

    The test stub always runs both connectionless and connection-oriented chat apps. So when you run testStub, always put the both ports even though you will use either of the two modes. When your program initiates contact with the test stub, the stub will echo back your chat lines with a little bit of its own.

    When you initiate a chat session with a remote host, you can leave the Receiver field in the first chat message blank. Similarly, when the test stub initiates contact with you, the receiver field of the first message will be blank.

    When the test stub initiates contact with you, the receiver field of the first message will be blank.

    To have the test stub initiate contact with your program, run both your program and test stub and then use the ready utility as follows:

  • java ReadyConn -a [testStub IP address] -p1 [testStub listening port for Conn] -p2 [testStub listening port for ConnLess] -la [your program IP address] -lp [your program listening port]

  • java ReadyNoConn -a [testStub IP address] -p1 [testStub listening port for Conn] -p2 [testStub listening port for ConnLess] -la [your program IP address] -lp [your program listening port]

    Use ReadyNoConn to have the test stub initiate a connectionless chat session with your program, and ReadyConn otherwise.

    (Added 3/28/2007) If the test stub is an initial sender, it will transmit "BYE" message to an initial receiver within 10 messages for both connection-orineted and connectionless modes.

    Your program is expected to be able to initiate a chat session with the test stub in both the connectionless and connection oriented modes. In addition, your program is expected to handle chat sessions initiated by the test stub(s) in either mode.

    Specifically, your program should handle the case when multiple instances of testStub talk to it simultaneously, either in connection-oriented or connectionless mode. And if there is any problem please post on coursework or email us.

    Good luck!