11 public class UDP implements Runnable{
\r
12 private DatagramSocket $udpSock = null;
\r
14 public UDP(int $port)throws Exception{
\r
15 $udpSock = new DatagramSocket($port);
\r
16 $udpSock.setReceiveBufferSize(1024*1024);
\r
17 new Thread(this).start();
\r
21 while($udpSock != null){
\r
26 public void receive(){
\r
28 DatagramPacket $packet = new DatagramPacket(new byte[1400],1400);
\r
29 $udpSock.receive($packet);
\r
30 new UDPW($packet,$udpSock);
\r
31 }catch(Exception $e){$e.printStackTrace();}
\r
34 public void shutdown(){
\r
37 }catch(Exception $e){$e.printStackTrace();}
\r