UDPCommsDelegate
@protocol UDPCommsDelegate <NSObject>
Callback methods for delegate of a UDPEndpoint object.
-
Called after successfully receiving data. On a server object this data will automatically be echoed back to the sender.
Declaration
Objective-C
- (void)didReceiveData:(NSData *)data fromAddress:(NSData *)addr;
Swift
optional func didReceive(_ data: Data!, fromAddress addr: Data!)
Parameters
data
- bytes received.
addr
- an NSData containing some form of (struct sockaddr), specifically a (struct sockaddr_in) or (struct sockaddr_in6)
-
Called after a failure to receive data.
Declaration
Objective-C
- (void)didReceiveError:(NSError *)error;
Swift
optional func didReceiveError(_ error: Error!)
Parameters
error
- error description
-
Called after successfully sending data.
Declaration
Objective-C
- (void)didSendData:(NSData *)data toAddress:(NSData *)addr;
Swift
optional func didSend(_ data: Data!, toAddress addr: Data!)
Parameters
data
- bytes to send.
addr
- an NSData containing some form of (struct sockaddr), specifically a (struct sockaddr_in) or (struct sockaddr_in6)
-
Called after a failure to send data.
Declaration
Objective-C
- (void)didFailToSendData:(NSData *)data toAddress:(NSData *)addr error:(NSError *)error;
Swift
optional func didFail(toSend data: Data!, toAddress addr: Data!, error: Error!)
Parameters
data
- bytes to send.
addr
- an NSData containing some form of (struct sockaddr), specifically a (struct sockaddr_in) or (struct sockaddr_in6)
-
Called after the object has successfully started up. On the client addresses is the list of addresses associated with the host name passed to -startConnectedToHostName:port:. On the server, this is the local address to which the server is bound.
Declaration
Objective-C
- (void)didStartWithAddress:(NSData *)address;
Swift
optional func didStart(withAddress address: Data!)
Parameters
address
- an NSData containing some form of (struct sockaddr) e.g. a (struct sockaddr_in) or (struct sockaddr_in6)
-
Called after the object stops spontaneously (that is, after some sort of failure, but now after a call to -stop).
Declaration
Objective-C
- (void)didStopWithError:(NSError *)error;
Swift
optional func didStopWithError(_ error: Error!)
Parameters
error
- error description