Advertisement
Guest User

Untitled

a guest
Feb 21st, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. package com.udp;
  2. import java.io.IOException;
  3. import java.net.*;
  4.  
  5.  
  6. public class Client{
  7.  
  8. private DatagramSocket socket;
  9. private byte[] buf = new byte[256];
  10. private String host_name;
  11. private int port_number;
  12. private String opr;
  13. private
  14.  
  15. public static void main(String[] args) throws IOException{
  16.  
  17.  
  18. if(args.length != 4) {
  19. System.out.println("Error calling method");
  20. return;
  21. }
  22.  
  23. new Client().startClient(args);
  24.  
  25. }
  26.  
  27. public void startClient(String[] args) throws IOException {
  28.  
  29.  
  30. boolean running = true;
  31. socket = new DatagramSocket(port);
  32.  
  33. while(running) {
  34. DatagramPacket packet = new DatagramPacket(buf, 256);
  35. socket.receive(packet);
  36.  
  37. }
  38.  
  39. }
  40.  
  41. public void
  42.  
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement