Can specify a custom Bonjour service type for the server.

This commit is contained in:
jaanus
2014-05-16 11:18:47 +02:00
parent 04a69787bf
commit 8ab53f74d5
2 changed files with 59 additions and 2 deletions

View File

@ -83,6 +83,13 @@ extern NSString* const GCDWebServerOption_Port;
*/
extern NSString* const GCDWebServerOption_BonjourName;
/**
* The Bonjour service type used by the GCDWebServer (NSString).
*
* The default value is "_http._tcp", standard HTTP web server.
*/
extern NSString* const GCDWebServerOption_BonjourType;
/**
* The maximum number of incoming HTTP requests that can be queued waiting to
* be handled before new ones are dropped (NSNumber / NSUInteger).
@ -266,6 +273,14 @@ extern NSString* const GCDWebServerAuthenticationMethod_DigestAccess;
*/
@property(nonatomic, readonly) NSString* bonjourName;
/**
* Returns the Bonjour service type used by the server.
*
* @warning This property is only valid if the server is running and Bonjour
* registration has successfully completed, which can take up to a few seconds.
*/
@property(nonatomic, readonly) NSString* bonjourType;
/**
* This method is the designated initializer for the class.
*/
@ -341,6 +356,18 @@ extern NSString* const GCDWebServerAuthenticationMethod_DigestAccess;
*/
- (BOOL)startWithPort:(NSUInteger)port bonjourName:(NSString*)name;
/**
* Starts the server on a given port and with a specific Bonjour name and type.
* Pass a nil Bonjour name to disable Bonjour entirely or an empty string to
* use the computer / device name.
* Pass a nil or empty string to Bonjour type to use the standard
* HTTP web server type "_http._tcp".
*
* Returns NO if the server failed to start.
*/
- (BOOL)startWithPort:(NSUInteger)port bonjourName:(NSString*)name bonjourType:(NSString*)bonjourType;
#if !TARGET_OS_IPHONE
/**
@ -354,6 +381,18 @@ extern NSString* const GCDWebServerAuthenticationMethod_DigestAccess;
*/
- (BOOL)runWithPort:(NSUInteger)port bonjourName:(NSString*)name;
/**
* Runs the server synchronously using -startWithPort:bonjourName:bonjourType:
* until a SIGINT signal is received i.e. Ctrl-C. This method is intended
* to be used by command line tools.
*
* Returns NO if the server failed to start.
*
* @warning This method must be used from the main thread only.
*/
- (BOOL)runWithPort:(NSUInteger)port bonjourName:(NSString*)name bonjourType:(NSString*)bonjourType;
/**
* Runs the server synchronously using -startWithOptions: until a SIGTERM or
* SIGINT signal is received i.e. Ctrl-C in Terminal. This method is intended to