ECE385H1 Lecture Notes - Session Id, Computer Network Programming, Master Sergeant

38 views5 pages
Published on 12 Apr 2013
School
Course
Professor
This is the official lab specifications
ECE361H1S Computer Networks I
Lab 3: Text Conferencing
Due Date
March 31st, 2013. 5pm
Project Goal
This assignment will give you hands-on experience with socket programming in Java. You will
be using Java ServerSocket and Socket to implement a simple conference application similar to
IRC or MSN.
Project Description
In this lab, you will create a server application and a client application that works with it. A
conferencing application consists of a server, which registers users and several client nodes, as
the end points for a particular conference session. The clients may be located on different
networks. TCP will be used to allow communications between the clients and the server.
Each client has a unique name referred to as the identifier (a user ID of type Integer, or a user
name of type String). The ID of a node is unique among all participating nodes. When a client
first registers with the server, it must also submit its ID. Upon registration, the server will create
a binding between the client ID and its IP address. Remember that IP addresses are not always
static, nor is the user name associated with a particular computer. Your server should therefore
be able to handle changes in IP address for a given ID. This does not need to be complicated.
Hint: the server does not need to keep the registration information after a client logs out.
When a client wishes to communicate with other clients, it must create a conference session on
the server. A conference session is simply a list of clients (at least one) that are sending text
messages to one another. Messages sent by a single user should be seen by all participating
clients in the same conference session. It is the server’s responsibility to multicast the text data to
all participating clients.
You will be implementing both the server and the client application. To help you get started,
some class definitions, together with this handout, will be provided. The protocol specification
described in the sections that follow is very flexible; and you may make changes as you see fit.
TCP socket tutorial
Oracle provides official documentations on all aspects of Java programming. Specifically, the
following link offers an introduction on Java TCP socket programming with examples. Pay
attention to the example code as it shows you how to program server in a multi-threaded fashion.
http://docs.oracle.com/javase/tutorial/networking/sockets/index.html
Unlock document

This preview shows pages 1-2 of the document.
Unlock all 5 pages and 3 million more documents.

Already have an account? Log in
This is the official lab specifications
Protocol
The following protocol is only a suggestion. Feel free to amend, or even use a completely
different protocol. In our formulation, there are two types of messages: data and control
messages. Control messages are used for registration, address resolution, session creation,
invitation, and termination. Since you are using TCP, you do not need to use acknowledgements
for reliability on the transportation layer. However, application layer acknowledgements may
still be necessary. Therefore, we might need acknowledgements for success/failure conditions at
the server, e.g. was registration successful, or did someone already take the same user name?
Consider following structure for the data and control messages.
Public class Package {
Public emun PackageType{
REG,
REG_ACK,
// and etc.
}
PacketType type;
int dataLength;
String username;
String data;
};
The type indicates the type of the message. There are various types of messages in this
assignment. They are described in the table below. The length field should be used to identify
the length of the payload, i.e., the length of data. The userName field contains the client name (or
user ID if you choose to use integers as IDs) of the client sending the message.
The following table shows all control packets:
id
packet data
function
REG
<client ID>
Register with the server
REG_ACK
Acknowledge successful registration
REG_NACK
Negative acknowledgement of registration
DREG
Deregister from the server
JOIN
<session ID>
Join a conference session
JOIN_ACK
Acknowledge successful conference session join
JOIN_NACK
Negative acknowledgement of joining the session
DET
Leave a conference session
CONF
Create new conference session
CONF_ACK
<session ID>
Acknowledge new conference session and return session ID
INV
<client ID>
Invite a client to join a session
INV_ACK
User invited to a session successfully
INV_NACK
User doesn’t exist, or is already in another session
MSG
<msg data>
Send a message to the session or display the message if it is
received
Unlock document

This preview shows pages 1-2 of the document.
Unlock all 5 pages and 3 million more documents.

Already have an account? Log in

Document Summary

This assignment will give you hands-on experience with socket programming in java. You will be using java serversocket and socket to implement a simple conference application similar to. In this lab, you will create a server application and a client application that works with it. A conferencing application consists of a server, which registers users and several client nodes, as the end points for a particular conference session. The clients may be located on different networks. Tcp will be used to allow communications between the clients and the server. Each client has a unique name referred to as the identifier (a user id of type integer, or a user name of type string). The id of a node is unique among all participating nodes. When a client first registers with the server, it must also submit its id. Upon registration, the server will create a binding between the client id and its ip address.

Get OneClass Grade+

Unlimited access to all notes and study guides.

YearlyMost Popular
75% OFF
$9.98/m
Monthly
$39.98/m
Single doc
$39.98

or

You will be charged $119.76 upfront and auto renewed at the end of each cycle. You may cancel anytime under Payment Settings. For more information, see our Terms and Privacy.
Payments are encrypted using 256-bit SSL. Powered by Stripe.