objc ios check local ip response

hi, we need to check if a thermal printer (ip address on port 9100 tcp) is ready or not response... any suggest?? like as ping system?

Replies

Are you printing to the print directly, using networking APIs? Or via iOS’s printing system?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
directly using tcp api

directly using tcp api

In that case the only guaranteed way to know whether you can connect to a particular remote peer is to actually try the connection. Everything else is just a heuristic. For example, you could ping the remote peer using ICMP, but that can yield both false positives (the host might be online but no one is listening on the port) and false negatives (some networks block pings; some hosts don’t respond to pings).



Can you explain more about the context here? The usual approach for printing is something like this:
  1. User starts a print job.

  2. You try connecting to the printer.

  3. If that fails, you tell the user.

  4. If it works, you print.

That approach is compatible with the advice above, namely, that you shouldn’t try to preflight network connections but rather just try connecting and deal with any errors that come up. However, it sounds like you’re trying to implement some other approach. What is that?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"