Lab 3/4 CS

UDP Programming in Java

Lab Objective:

  • To gain experience using Unix/Linux UDP socket programming using Java.
  • To use multicast UDP messaging
Reading/Reference: Lab overview:

Java is an important language, and syntacically VERY similar to C++. In this lab we will create a simple Java chat program to begin to learn Java, and networking in Java.

IP addressing includes multicast addresses, which all for a system to send a packet to multiple recipients. The multicast addresses are in the range through Below is an example of it's use.

Sample code

1. A simple UDP sender adn receiver

2. A UDP sender and receiver using a simple GUI interface

3. A Simple Threads Example

4. Sending and receiving Multicast Packets

UDP packets can be sent to any multicast address (on any port) in the through address range. The sendrer must send using a MulticastSocket() function to create the socket, and the receiver must create a socket with MulticastSocket (port), and then join the multicast group using the MulticastSocket(address) function.

Using Java at the command line

To Compile: javac

To Run: Java file

Lab tasks:

The lab is worth 100 points total. Below I give you a set of requirements and options. You may do as many or few – this is a chance to get extra credit. However, no matter what you do, you will not get higher then a 100 if you do not have good clean code. Your score is dependant on the highest level of CS course you have taken.

Feature CS II Soft Dev Op Sys
Well Designed/Written Code 20 20 20
Well commented code 5 5 5
Synchronous two-way chat function (take turns typing) 30 20 10
Display username of partner. 15 10 5
Display "Typing" if other user typing 20 15 10
Character at a time transmission/reception 20 15 10
N-way chat 35 30 25
Asynchronous two-way chat function 40 30 25
Search for and list available partners (use multicast or broadcast beacon) 30 25 20
MAXIMUM SCORE 230 185 145

Turn in

  1. A document listing the features you support
  2. Screen captures clearly (with headings) demonstrating each feature support above.
  3. All source code (including makefile)
-- JimSkon - 2011-09-18
Topic revision: r9 - 2013-10-14 - JimSkon
This site is powered by the TWiki collaboration platformCopyright &© by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback