Project socket programming - udp objectives - learn socket

Assignment Help JAVA Programming
Reference no: EM13346645

Project: Socket Programming - UDP

Objectives:

- Learn socket programming in Java: UDP

-  Cement your understanding of reliable transfer protocols

Develop a reliable transfer protocol over UDP. Focus on a Stop- and-Wait protocol.

Overview

This framework provides:

-  a template for the reliable transfer protocol implementation.

-  a testing framework, with a graphical user interface.

How to use the testing framework later in the project description.

The main goal of this project is to implement a Stop-and-wait reliable transfer protocol based on the provided template.

-  MyDataPacket,
-  MyAckPacket,
-  MyServerSocket and  
-  MySocket

The former two classes are used to handle data and ack packets, respectively. They are fully implemented. Implement the latter two classes, i.e., MyServerSocket and MySocket. These classes have the following interface:

class MySocket
{
    public MySocket(InetAddress IPAddress, int portNumber)
 
    public OutputStream getOutputStream()
}
 
class MyServerSocket
{
    public MyServerSocket(int port)
 
    public InputStream getInputStream()
}

These classes are quite similar to the TCP sockets available in Java: Socket and ServerSocket. Therefore, we make a few simplifications:

-  No connection-level multiplexing. We assume that only one client at a time connects to a MyServerSocket open at a given port. Therefore, MyServerSocket has no accept method.

Furthermore, we are not going to implement any mechanisms for opening or closing of connections.

-  Unidirectional transfer. Our sockets implement transfer of data in one direction only. To send data, MySocket must be used. To receive data, MyServerSocket is used.

Consequently, there is no getInputStream in MySocket and no getOutputSteam in MyServerSocket

A benefit of the above interface is that we can use it with all the familiar stream classes available in Java, such as DataOutputStream or BufferedReader. An example program that would use our sockets can look as follows:

// Sender (Client)
    ...
    MySocket socket = new

MySocket(InetAddress.getHostByName("somhostname.edu"), 12345);

    DataOutputStream out = new DataOutputStream(socket.getOutputStream());

    out.writeBytes("Hello world!");
    ... 

// Receiver (Server)
    ...

    MyServerSocket serverSocket = new MyServerSocket(12345);

    BufferedReader in = new BufferedReader(new

InputStreamReader(serverSocket.getInputStream()));

    String sentence = in.readLine();

    System.out.println("Received: " + sentence);
    ...

Reference no: EM13346645

Questions Cloud

The users will use a browser to access the on-line store : the users will use a browser to access the on-line store. the web server software for the production web server is
Structural modelingstructural modeling is a different view : structural modelingstructural modeling is a different view of the same system that you analyzed from a functional
Q1a express the shannon-hartley capacity theorem in terms : q1a express the shannon-hartley capacity theorem in terms of where is the energybit and is the psd of white
Recursive tree algorithmsalgorithms to write1 write a : recursive tree algorithmsalgorithms to write1. write a recursive function to determine if a binary tree is a binary
Project socket programming - udp objectives - learn socket : project socket programming - udp objectives - learn socket programming in java udp-nbsp cement your understanding of
Create a web site for an apple farm john smith has been a : create a web site for an apple farm. john smith has been a farmer for a number of years and he has been using an
Stock market project1 building portfolionbsp select five : stock market project1. building portfolionbsp select five companies for the purpose of tracking the stock market
Shopping cart program for web applications classpurpose - : shopping cart program for web applications classpurpose - allows user to browse while keeping track of the items in
Consider the following data for abc enterprises all numbers : consider the following data for abc enterprises all numbers in euro today is january 1 2013 income statement for 2012

Reviews

Write a Review

JAVA Programming Questions & Answers

  Record managing system application

Build a student record managing system application

  Write java program which will permit user to make selection

Write the Java Program which will permit the user to make selection. You will present user with two options to perform, then you will perform action selected by user.

  Write complete java program to read from keyboard

Write complete Java program to read, from keyboard, a student's first and last name and six grades. It will display on screen last name then first letter of first name with a period.

  Write a program displaying a text file that is in a text are

Write a program displaying a text file that is in a text area. The user enteres a file name in a text field and clicks the view button; the file is then displayed in the text area. Do not use BufferedInputStream.

  Check wether two appointments overlap

in a scheduling program, we want to check wether two appointments overlap. For simplicity, appointments start at a full hour,

  Critics of american often that teacher''s unions represent

Which organization has proposed a set of standards for both elementary level and secondary-level teachers? According to the latest info.,  teachers will be most needed in which of the following areas: Critics of American often argue that teacher's un..

  Utilizes a good design process

Analyze, design, and document a simple program that utilizes a good design process and incorporates sequential, selection and repetitive programming statements as well as at least one function call and the use of at least one array.

  Implement an intrusion detection system in java

You are to implement an intrusion detection system in java. Calculate a threshold for detecting an intrusion. The threshold is 2*(Sums of weights).

  An elementary calculation yields the result

An elementary calculation yields the result that theoretically, the probability of turning up 7 when two dice are thrown is 1/6, or .166666. But what if more dice are thrown? If 3 dice are thrown, what is the probability that some 2 of three sum to 7..

  Allows a user to select a favorite basketball team

Write an application that allows a user to select a favorite basketball team from a list box. Include at least five teams in the list, and display the chosen team in a text field after the user makes a selection. Save the file as JBasketball.java. :

  Prepare a java simulation program

Given a hash function h, prepare a java simulation program to determine each of the subsequent quantities after 0.8*tablesize random keys have been generated. The keys should be random integers.

  Write a program that displays a drawing popular hangman game

Write a program that displays a drawing for the popular hangman game, as shown in Figure 15.32(c). draws a sketch for the hangman game.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd