@exosceleton--My guess would be that Matlab's java machine is not doing garbage collecting properly (I've seen similar problems with Matlab's implementation of database cursor objects). So when you go through 256 IP addresses, you're creating 256 Java Socket objects, and they're clogging up Matlab's allocated Java space and slowing down your computer. As a workaround, why not send a single packet out to your network's broadcast address (see http://en.wikipedia.org/wiki/Broadcast_address)? You should be able to use 255.255.255.255 in your call to jupd.m. All the machines on your network will receive the UDP packet, but only the machine you're looking for will know how to respond to the specific UDP packet you send. Once this "handshake" is complete, the two computers will know each other's IP addresses, and you will no longer need to use the broadcast address.
If i enter a static ip of the destination i can send&recieve at a quick rate (multiple cycles per second).
However when i change the ip address in a loop in an attempt to find the the correct device ip in a DHCP environment the cycle time quickly increases to multiple seconds per send&recieve command.
looking for the device from ip xxx.xxx.xxx.1:255 takes minutes.
is there a reason for this change in processing time between a fixed ip or multiple ip destinations?
When I send UDP packets using this script, the destination UDP port number stays fixed to the one passed in the argument but source UDP port number seems to be incrementing by 1 every time I call judp. Is there a way to have a fix source UDP port number as well?
Thanks in advance.