FWAsyncUdpSocketDelegate

@protocol FWAsyncUdpSocketDelegate <NSObject>
@optional

/**
 * By design, UDP is a connectionless protocol, and connecting is not needed.
 * However, you may optionally choose to connect to a particular host for reasons
 * outlined in the documentation for the various connect methods listed above.
 * 
 * This method is called if one of the connect methods are invoked, and the connection is successful.
**/
- (void)udpSocket:(FWAsyncUdpSocket *)sock didConnectToAddress:(NSData *)address;

/**
 * By design, UDP is a connectionless protocol, and connecting is not needed.
 * However, you may optionally choose to connect to a particular host for reasons
 * outlined in the documentation for the various connect methods listed above.
 * 
 * This method is called if one of the connect methods are invoked, and the connection fails.
 * This may happen, for example, if a domain name is given for the host and the domain name is unable to be resolved.
**/
- (void)udpSocket:(FWAsyncUdpSocket *)sock didNotConnect:(NSError * _Nullable)error;

/**
 * Called when the datagram with the given tag has been sent.
**/
- (void)udpSocket:(FWAsyncUdpSocket *)sock didSendDataWithTag:(long)tag;

/**
 * Called if an error occurs while trying to send a datagram.
 * This could be due to a timeout, or something more serious such as the data being too large to fit in a sigle packet.
**/
- (void)udpSocket:(FWAsyncUdpSocket *)sock didNotSendDataWithTag:(long)tag dueToError:(NSError * _Nullable)error;

/**
 * Called when the socket has received the requested datagram.
**/
- (void)udpSocket:(FWAsyncUdpSocket *)sock didReceiveData:(NSData *)data
                                             fromAddress:(NSData *)address
                                       withFilterContext:(nullable id)filterContext;

/**
 * Called when the socket is closed.
**/
- (void)udpSocketDidClose:(FWAsyncUdpSocket *)sock withError:(NSError  * _Nullable)error;

@end

Undocumented

    • By design, UDP is a connectionless protocol, and connecting is not needed.
    • However, you may optionally choose to connect to a particular host for reasons
    • outlined in the documentation for the various connect methods listed above.
    • This method is called if one of the connect methods are invoked, and the connection is successful.

    Declaration

    Objective-C

    - (void)udpSocket:(nonnull FWAsyncUdpSocket *)sock
        didConnectToAddress:(nonnull NSData *)address;
    • By design, UDP is a connectionless protocol, and connecting is not needed.
    • However, you may optionally choose to connect to a particular host for reasons
    • outlined in the documentation for the various connect methods listed above.
    • This method is called if one of the connect methods are invoked, and the connection fails.
    • This may happen, for example, if a domain name is given for the host and the domain name is unable to be resolved.

    Declaration

    Objective-C

    - (void)udpSocket:(nonnull FWAsyncUdpSocket *)sock
        didNotConnect:(NSError *_Nullable)error;
    • Called when the datagram with the given tag has been sent.

    Declaration

    Objective-C

    - (void)udpSocket:(nonnull FWAsyncUdpSocket *)sock didSendDataWithTag:(long)tag;
    • Called if an error occurs while trying to send a datagram.
    • This could be due to a timeout, or something more serious such as the data being too large to fit in a sigle packet.

    Declaration

    Objective-C

    - (void)udpSocket:(nonnull FWAsyncUdpSocket *)sock
        didNotSendDataWithTag:(long)tag
                   dueToError:(NSError *_Nullable)error;
    • Called when the socket has received the requested datagram.

    Declaration

    Objective-C

    - (void)udpSocket:(nonnull FWAsyncUdpSocket *)sock
           didReceiveData:(nonnull NSData *)data
              fromAddress:(nonnull NSData *)address
        withFilterContext:(nullable id)filterContext;
    • Called when the socket is closed.

    Declaration

    Objective-C

    - (void)udpSocketDidClose:(nonnull FWAsyncUdpSocket *)sock
                    withError:(NSError *_Nullable)error;