Skip to content

Commit

Permalink
Latest changes to ipv6 test
Browse files Browse the repository at this point in the history
  • Loading branch information
gcasa committed Nov 2, 2023
1 parent e8b885a commit 087bcf6
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion Tests/base/NSStream/ipv6test.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,43 @@
#import <Foundation/Foundation.h>
#import "Testing.h"

@interface IPV6Server : NSObject

- (void) main;

@end

@implementation IPV6Server

- (void) main
{
}

@end

int main()
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];

NSInputStream *inputStream;
NSOutputStream *outputStream;
IPV6Server *svr = [[IPV6Server alloc] init];

NSString *ipv6ServerAddress = @"::1"; // Replace with your actual IPv6 server address
uint16_t port = 12345; // Replace with the actual port number

// Resolve the IPv6 address using NSHost
NSHost *host = [NSHost hostWithName: ipv6ServerAddress];
NSArray *addresses = [host addresses];

PASS([addresses count] > 0, "Resolve IPv6 address");

NSString *ipv6Address = [addresses objectAtIndex: 0];
NSThread *thread = [[NSThread alloc] initWithTarget: svr selector: @selector(main) object: nil];

PASS(thread != nil, "Created thread for server");

[thread start];

[NSStream getStreamsToHost: [NSHost hostWithName: ipv6Address]
port: port
Expand Down

0 comments on commit 087bcf6

Please sign in to comment.