ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/experimental/server/XMLReader/UDPReaderThread.java
Revision: 1.2
Committed: Fri Nov 17 12:16:39 2000 UTC (23 years, 5 months ago) by pjm2
Branch: MAIN
Changes since 1.1: +12 -0 lines
Log Message:
Changed a lot of parts of UDPReader, UDPReaderThread, XMLPacketMaker,
XMLPacketParser and XMLSender so that they all work together.  XMLSender
is just a summy program to send UDP data to the UDPReader.

File Contents

# Content
1 import java.io.*;
2 import java.net.*;
3 import java.util.*;
4
5 public class UDPReaderThread extends Thread{
6
7 public UDPReaderThread(DatagramPacket packet){
8 try {
9 xml = new String(packet.getData());
10 }
11 catch (Exception e) {
12 System.out.println("An exception occured while attempting to return an XMLPacket!");
13 e.printStackTrace();
14 }
15 }
16
17 public void run(){
18
19 System.out.println("UDPReaderThread - Received the following raw stuff: "+xml);
20
21 XMLPacketMaker xmlPacketMaker = new XMLPacketMaker(xml);
22 XMLPacket packet = xmlPacketMaker.createXMLPacket();
23
24 if (packet == null){
25 System.out.println("UDPReaderThread - A null XMLPacket was returned, I think I'll ignore it!");
26 return;
27 }
28 System.out.println("UDPReaderThread - An XML Packet was read sucessfully: -");
29 packet.printAll();
30 // Now do something with this XMLPacket!!!
31 // ....
32 }
33
34 String xml;
35 }