dpanshu
dpanshu

Reputation: 463

DatagramPacket Constructor not found

The following code produces "no suitable constructor found" error. I am unable to figure out a reason.

   try {
        Sock = new DatagramSocket();             
        InetAddress IP_add=InetAddress.getByName("192.168.1.2");
        DatagramPacket PACKET=new DatagramPacket(buf,buf.length,IP_add,2000);

       } catch (Exception e) {}

Upvotes: 0

Views: 674

Answers (1)

Sergii Zagriichuk
Sergii Zagriichuk

Reputation: 5399

There are e few options

  1. Your buf instance is not array of byte, has to be byte []
  2. You are using InetAddress not from package java.net

Recheck it, I think the first point will help you.

Upvotes: 2

Related Questions