Instance Method

setDataReceiveHandler:withContext:

Sets the object that handles data received from other peers connected to the session.

Declaration

- (void)setDataReceiveHandler:(id)handler withContext:(void *)context;

Parameters

handler

The object you want the session to call when it receives data from other peers.

context

Arbitrary data to be passed to each invocation of the handler.

Discussion

The handler must implement a method with the following signature:

- (void) receiveData:(NSData *)data fromPeer:(NSString *)peer inSession: (GKSession *)session context:(void *)context;

where data contains the bytes received from a remote peer, peer is a string that identifies the peer, session is the session that received the data, and context is the same context that was passed into the original call to setDataReceiveHandler:withContext:.

See Also

Working with Connected Peers

- sendData:toPeers:withDataMode:error:

Transmits a collection of bytes to a list of connected peers.

Deprecated
- sendDataToAllPeers:withDataMode:error:

Transmits a collection of bytes to all connected peers.

Deprecated
disconnectTimeout

A time interval that expresses how long the session waits before it disconnects a nonresponsive peer.

Deprecated
- disconnectFromAllPeers

Disconnects the session from all connected peers.

Deprecated
- disconnectPeerFromAllPeers:

Disconnects a connected peer from all peers connected to the session.

Deprecated