Instance Method

netService:didAcceptConnectionWithInputStream:outputStream:

Called when a client connects to a service managed by Bonjour.

Declaration

- (void)netService:(NSNetService *)sender didAcceptConnectionWithInputStream:(NSInputStream *)inputStream outputStream:(NSOutputStream *)outputStream;

Parameters

sender

The net service object that the client connected to.

inputStream

A stream object for receiving data from the client.

outputStream

A stream object for sending data to the client.

Discussion

When you publish a service, if you set the NSNetServiceListenForConnections flag in the service options, the service object accepts connections on behalf of your app. Later, when a client connects to that service, the service object calls this method to provide the app with a pair of streams for communicating with that client.