21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#import "ObjFW.h"
#import "ObjFWTest.h"
@interface OFUNIXDatagramSocketTests: OTTestCase
@end
@implementation OFUNIXDatagramSocketTests
- (void)testUNIXDatagramSockets
{
OFUNIXDatagramSocket *sock = [OFUNIXDatagramSocket socket];
OFString *path;
OFSocketAddress address1, address2;
char buffer[5];
#if defined(OF_HAVE_FILES) && !defined(OF_IOS)
|
|
|
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#import "ObjFW.h"
#import "ObjFWTest.h"
@interface OFUNIXDatagramSocketTests: OTTestCase
@end
@implementation OFUNIXDatagramSocketTests
- (void)testUNIXDatagramSocket
{
OFUNIXDatagramSocket *sock = [OFUNIXDatagramSocket socket];
OFString *path;
OFSocketAddress address1, address2;
char buffer[5];
#if defined(OF_HAVE_FILES) && !defined(OF_IOS)
|
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
@try {
address1 = [sock bindToPath: path];
} @catch (OFBindSocketFailedException *e) {
switch (e.errNo) {
case EAFNOSUPPORT:
case EPERM:
OTSkip(@"UNIX datagram sockets unsupported");
return;
default:
@throw e;
}
}
@try {
[sock sendBuffer: "Hello" length: 5 receiver: &address1];
|
<
|
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
@try {
address1 = [sock bindToPath: path];
} @catch (OFBindSocketFailedException *e) {
switch (e.errNo) {
case EAFNOSUPPORT:
case EPERM:
OTSkip(@"UNIX datagram sockets unsupported");
default:
@throw e;
}
}
@try {
[sock sendBuffer: "Hello" length: 5 receiver: &address1];
|