11 public class UDP implements Runnable{
\r
12 private DatagramSocket $udpSock = null;
\r
14 public UDP(int $port)throws Exception{
\r
15 System.out.println("SERVER UDP: "+$port);
\r
16 $udpSock = new DatagramSocket($port);
\r
17 $udpSock.setReceiveBufferSize(1024*1024);
\r
18 new Thread(this).start();
\r
22 while($udpSock != null){
\r
27 public void receive(){
\r
29 DatagramPacket $packet = new DatagramPacket(new byte[1400],1400);
\r
30 $udpSock.receive($packet);
\r
31 new UDPW($packet,$udpSock);
\r
32 }catch(Exception $e){$e.printStackTrace();}
\r
35 public void shutdown(){
\r
38 }catch(Exception $e){$e.printStackTrace();}
\r