Errorsimulator.java

Errorsimulator.java - /* * @(#)Errorsimulator.java * * *...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
/** * @(#)Errorsimulator.java * * * @author * @version 1.00 2009/8/2 */ import java.io.*; import java.net.*; import java.util.*; public class Errorsimulator implements Runnable { DatagramPacket receivePacket,sendPacket; DatagramSocket listningSocket,sendingSocket; String receivedOpcode ,changedOpcode; int serverPort, changedPort; int delay,clientPort; InetAddress clientAddress,serverAddress; // this array will contain the message from received packet byte request [] = new byte [512]; public void run(){ //receives the packets try{ listningSocket = new DatagramSocket(68); }catch(SocketException e){ System.err.println(e); } try{ sendingSocket = new DatagramSocket(); }catch(SocketException e){ System.err.println(e); } //packet created receivePacket = new DatagramPacket(request,request.length); //receiveing socket try{ listningSocket.receive(receivePacket); }catch(IOException e){ System.out.println(e); } //getting the address and port of the client clientAddress(receivePacket); //extract data from packet
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/26/2009 for the course SCE Sysc3303 taught by Professor Marshall during the Summer '09 term at Carleton CA.

Ask a homework question - tutors are online