Differences From Artifact [4d2bc6e16e]:
- File
tests/OFSCTPSocketTests.m
— part of check-in
[816c13da9b]
at
2024-05-01 23:23:46
on branch sctp
— OFSCTPSocket: Rename packet to message
Let's use the proper terminology for the protocol. (user: js, size: 2002) [annotate] [blame] [check-ins using]
To Artifact [749f241e9f]:
- File
tests/OFSCTPSocketTests.m
— part of check-in
[0fd2b1b4c8]
at
2024-05-04 20:05:40
on branch sctp
— OFSCTPSocket: Use a dictionary for message info
This is more extensible. Without this, extending it later would result
in an API and ABI breakage. (user: js, size: 2167) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
30 31 32 33 34 35 36 | @implementation OFSCTPSocketTests - (void)testSCTPSocket { OFSCTPSocket *server, *client, *accepted; OFSocketAddress address; char buffer[6]; | | < | | 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]; OFNumber *streamID, *PPID, *unordered; OFSCTPMessageInfo sendInfo, receiveInfo; server = [OFSCTPSocket socket]; client = [OFSCTPSocket socket]; @try { address = [server bindToHost: @"127.0.0.1" port: 0]; } @catch (OFBindSocketFailedException *e) { |
︙ | ︙ | |||
57 58 59 60 61 62 63 64 65 | [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 | > > > > > > > | < < < | < | < < | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | [client connectToHost: @"127.0.0.1" port: OFSocketAddressIPPort(&address)]; accepted = [server accept]; OTAssertEqualObjects(OFSocketAddressString(accepted.remoteAddress), @"127.0.0.1"); streamID = [OFNumber numberWithUnsignedShort: 1]; PPID = [OFNumber numberWithUnsignedLong: 1234]; unordered = [OFNumber numberWithBool: true]; sendInfo = [OFDictionary dictionaryWithKeysAndObjects: OFSCTPStreamID, streamID, OFSCTPPPID, PPID, OFSCTPUnordered, unordered, nil]; [client sendBuffer: "Hello!" length: 6 info: sendInfo]; [accepted receiveIntoBuffer: buffer length: 6 info: &receiveInfo]; OTAssertEqual(memcmp(buffer, "Hello!", 6), 0); OTAssertEqualObjects(receiveInfo, sendInfo); } @end |