mergBonjour is an iOS external that implements bonjour service searching and registration.
Documentation
function mergBonjourSearch pType,[pDomain]
Create a search object and start searching for a bonjour service.
Parameters:
- pType - The pType parameter must contain both the service type and transport layer information. To ensure that the mDNS responder searches for services, rather than hosts, make sure to prefix both the service name and transport layer name with an underscore character (“_”). For example, to search for an HTTP service on TCP, you would use the type string “_http._tcp.“. Note that the period character at the end is required.
- pDomain - (optional with "" default) The pDomain parameter can be an explicit domain name, the generic local domain "local." (note trailing period, which indicates an absolute name), or the empty string (""), which indicates the default registration domains. Usually, you pass in an empty string.
Returns a pointer to the search in memory
command mergBonjourStopSearch pBonjourSearchPointer
Stop the search and release the search object from memory.
Parameters:
- pBonjourSearchPointer - a pointer to a bonjour search object in memory as returned by mergBonjourSearch
message mergBonjourServiceFound pType,pDomain,pName,pHostName,pIPs,pPort
Sent to the object that called mergBonjourSearch when a service has been found and resolved.
Parameters:
- pType - The pType parameter contains both the service type and transport layer information. For example, for an HTTP service on TCP, the type string would be “_http._tcp.“.
- pDomain - The pDomain parameter contains an explicit domain name such as generic local domain "local."
- pName - A unique name that may be presented to the user to choose the appropriate service from a list. Usually this is the device name.
- pHostName - The hostname the service was published on.
- pIPs - A list of IPs (one per line) for the service
- pPort - The port the service is published on.
message mergBonjourServiceRemoved pType,pDomain,pName,pHostName
Sent to the object that called mergBonjourSearch when a service is no longer available.
Parameters:
- pType - The pType parameter contains both the service type and transport layer information. For example, for an HTTP service on TCP, the type string would be “_http._tcp.“.
- pDomain - The pDomain parameter contains an explicit domain name such as generic local domain "local."
- pName - A unique name that may be presented to the user to choose the appropriate service from a list. Usually this is the device name.
- pHostName - The hostname the service was published on.
command mergBonjourRegisterService pType,pPort,[pDomain],[pName]
Publish a bonjour service. This command uses wait with messages style script blocking.
Parameters:
- pType - The pType parameter must contain both the service type and transport layer information. To ensure that the mDNS responder searches for services, rather than hosts, make sure to prefix both the service name and transport layer name with an underscore character (“_”). For example, to search for an HTTP service on TCP, you would use the type string “_http._tcp.“. Note that the period character at the end is required.
- pPort - The port on which the service is published.
- pDomain - (optional with "" default) The pDomain parameter can be an explicit domain name, the generic local domain "local." (note trailing period, which indicates an absolute name), or the empty string (""), which indicates the default registration domains. Usually, you pass in an empty string.
- pName - (optional with "" default) The name by which the service is identified to the network. The name must be unique. By using the default empty string ("") the system will automatically advertise the service under the device name eg ("Monte Goulding's iPhone").
Sets the result to a pointer to the service in memory. Use this pointer with mergBonjourStopService to end the service. If 0 is returned the service was not able to be registered. As the service will be stopped when it's released from memory if your app doesn't need to ever stop a service once started then there's no need to retain this pointer as the service will automatically stop when the app shuts down.
command mergBonjourStopService pBonjourServicePointer
Ends the bonjour service and releases it from memory,
Parameters:
- pBonjourServicePointer - a pointer to the bonjour service in memory.