FileDocCategorySizeDatePackage
UDPEchoServer.javaAPI DocExample717Sun Dec 12 10:54:00 GMT 2004None

UDPEchoServer

public class UDPEchoServer extends UDPServer

Fields Summary
public static final int
DEFAULT_PORT
Constructors Summary
public UDPEchoServer()


      
    super(DEFAULT_PORT); 
  
Methods Summary
public static voidmain(java.lang.String[] args)

 
   try {
     UDPServer server = new UDPEchoServer();
     server.start();
   }
   catch (SocketException ex) {
     System.err.println(ex);
   }
 
  
public voidrespond(java.net.DatagramPacket packet)


    try {
      DatagramPacket outgoing = new DatagramPacket(packet.getData(), 
       packet.getLength(), packet.getAddress(), packet.getPort());
      socket.send(outgoing);
    }
    catch (IOException ex) {
      System.err.println(ex);
    }