@@ -26,10 +26,11 @@ #endif #import "OFRunLoop.h" #import "OFRunLoop+Private.h" #import "OFBindFailedException.h" +#import "OFInitializationFailedException.h" #import "OFInvalidArgumentException.h" #import "OFNotConnectedException.h" #import "OFReadFailedException.h" #import "OFWriteFailedException.h" @@ -274,10 +275,20 @@ return hash; } @implementation OFUDPSocket ++ (void)initialize +{ + if (self != [OFUDPSocket class]) + return; + + if (!of_init_sockets()) + @throw [OFInitializationFailedException + exceptionWithClass: self]; +} + + (instancetype)socket { return [[[self alloc] init] autorelease]; }