It's my first time programming network in java. I want to use it in a small network. I was looking for a way to send to somehow broadcast to all nodes in the whole networking. To let them know of my existence. Someone told me send data packets to 255.255.255.255 so anyone in the network will receive it.
So I wrote this piece of code:
try{
Socket socket= new Socket("255.255.255.255", 3550);
}catch(Exception e){
System.out.println("oops! " + e.getMessage());
}
But, unfortunately it prints:
oops! Permission denied
When I change "255.255.255.255" to "192.168.1.3", which is my mate's IP address, it works fine. Also when I change "255.255.255.255" to "192.168.1.255", which according to ifconfig is my broadcast address, I get an Exception with the same message.
I'm in a adhoc network.
My OS is MAC OS X 10.6
My mate is in Windows Vista Home Premium Service Pack 1.
Please make it simple, I'm a newbie :)
Thanks in advance.