Hellooo,
Is there a way to compare a datagram packet's IP address with the host's IP address? Because i have a client/server (client is acting as a client & server) class that uses multisocket to broadcast to every host it'll send the datagram to itself as well, which i don't necessary want. To work around this i'm thinking to only print the receiving datagram packet if it's not from the host.
I was thinking of using this:
if (receivingPacket.getAddress() != InetAddress.getLocalHost().getHostAddress())
{
System.out.println(receivingMessage); // ReceivingMessage is just the receiving Packet's message
}
else
{
System.out.println("Debugging purpose...Packet's IP matches Host's IP");
}
I don't think this is ideal but hey if it works it'll be great.