I am trying to get a list of all the IP addresses on the local network. The reason for this is because I am writing an application using the STAR TSP100LAN printer.
The process of obtaining the printer's IP address is rather cumbersome for the end user. This includes turning off the printer, holding the paper feed button, turning the printer on again, waiting 15 seconds for the printer to obtain an IP address through DHCP, and then finally spitting out a receipt with this information on it.
Having seen that the printer is not turned on by Bonjour, is it possible to obtain an IP address using other methods?
Any help is much appreciated! I hope this is not a repeated question, but through my searches I cannot find a solution!
UPDATE : After a little thought, I came up with a pseudo-solution:
Find the current iPad address of the iPad through NSHost.
Remove the last quadrant from IPAddress
Using the stripped row as a prefix, repeat 1-255 for the last quadrant
- Each iteration tries to open the port to the specified address using the sdk printer. If I get a valid answer, I know that IP is a printer. If not, I exclude IP from the list of available printers.
While this works, I set a timeout of 5 milliseconds for each attempt to open the port. But they found that this could return some null results, even though there actually is a printer on the network with an assigned IP address.
Perhaps if I get a null result, the first time I should increase the timeout to 15 milliseconds for the second search attempt.
ios objective-c
happs
source share