ObjFW  Diff

Differences From Artifact [b41fd34ef1]:

To Artifact [24a1134449]:


30
31
32
33
34
35
36


37
38
39
40
41
42
43

@implementation OFSCTPSocketTests
- (void)testSCTPSocket
{
	OFSCTPSocket *server, *client, *accepted;
	OFSocketAddress address;
	char buffer[6];



	server = [OFSCTPSocket socket];
	client = [OFSCTPSocket socket];

	@try {
		address = [server bindToHost: @"127.0.0.1" port: 0];
	} @catch (OFBindSocketFailedException *e) {







>
>







30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

@implementation OFSCTPSocketTests
- (void)testSCTPSocket
{
	OFSCTPSocket *server, *client, *accepted;
	OFSocketAddress address;
	char buffer[6];
	uint16_t streamID;
	uint32_t PPID;

	server = [OFSCTPSocket socket];
	client = [OFSCTPSocket socket];

	@try {
		address = [server bindToHost: @"127.0.0.1" port: 0];
	} @catch (OFBindSocketFailedException *e) {
54
55
56
57
58
59
60
61
62
63



64


65
66
	[client connectToHost: @"127.0.0.1"
			 port: OFSocketAddressIPPort(&address)];

	accepted = [server accept];
	OTAssertEqualObjects(OFSocketAddressString(accepted.remoteAddress),
	    @"127.0.0.1");

	[client sendBuffer: "Hello!" length: 6];

	[accepted receiveIntoBuffer: buffer length: 6];



	OTAssertEqual(memcmp(buffer, "Hello!", 6), 0);


}
@end







|

|
>
>
>

>
>


56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
	[client connectToHost: @"127.0.0.1"
			 port: OFSocketAddressIPPort(&address)];

	accepted = [server accept];
	OTAssertEqualObjects(OFSocketAddressString(accepted.remoteAddress),
	    @"127.0.0.1");

	[client sendBuffer: "Hello!" length: 6 streamID: 1 PPID: 1234];

	[accepted receiveIntoBuffer: buffer
			     length: 6
			   streamID: &streamID
			       PPID: &PPID];
	OTAssertEqual(memcmp(buffer, "Hello!", 6), 0);
	OTAssertEqual(streamID, 1);
	OTAssertEqual(PPID, 1234);
}
@end