Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.udp;
- import java.io.IOException;
- import java.net.*;
- public class Client{
- private DatagramSocket socket;
- private byte[] buf = new byte[256];
- private String host_name;
- private int port_number;
- private String opr;
- private
- public static void main(String[] args) throws IOException{
- if(args.length != 4) {
- System.out.println("Error calling method");
- return;
- }
- new Client().startClient(args);
- }
- public void startClient(String[] args) throws IOException {
- boolean running = true;
- socket = new DatagramSocket(port);
- while(running) {
- DatagramPacket packet = new DatagramPacket(buf, 256);
- socket.receive(packet);
- }
- }
- public void
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement