Permission Denied trying to connect to localhost in unit test
Permission Denied trying to connect to localhost in unit test
- Subject: Permission Denied trying to connect to localhost in unit test
- From: Robert Walsh via Cocoa-dev <email@hidden>
- Date: Thu, 12 Dec 2019 15:42:01 +0000
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=envisionware.com; dmarc=pass action=none header.from=envisionware.com; dkim=pass header.d=envisionware.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NR1MMewfjJJDZ51hS5vOf7JloTGpT5Qt/gk2GINsIFg=; b=MXUlH+rO8VQITw73nCl74qo+d20qzNxxWHiBi5GxLa0tdFJgPZi7XN2CqgibAMOWx8O3aQ2EBLqVjWh8kOMGjOUQ8c7pt3H3IQ2Ob4VERVtOWDumvoXb8V2UHs03letVE9cLBNG1WwcRmM5Esgd4VJssFh6Duga1O80hqnNE4MJTltoPR87E/882i3jgX/v4bGVW/0O7+0Y/94Vi/RE7wpCsxZz8FLh8X+63kWubU1GsThb+Zb0WyFXpGD6wYKY/ns8AAnzAHuS6bIgML858Y/I995plH5qbq62nFZpM5WMbOW4fD2JvA6s3dVDWAyiCvmUDKqcDiDlMiFX39VPwIA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=i/ONiV2x4IP9x53cueFuezs37lRXc8JwseFUNi+6dHsDGW1bSvxsGqHTxsYCw5CsXkhbWynQJvsrWrfWomlGcdEgkv98yPvpzou7XyfGdkA3lL4KgU7q9l2cCB5JB41Y72LLOM0bG83kLGQprc1TqdZVFVaEFfAdsv738y4JIxanSlnLxBwBTEQgLoBrXW/aEwdVtuj3d2MURaBpxBKf20ijFjteSmilBiwhs0NcpXMhG6TzygKTQOdi07chhZId/ja/HBHf3ng9j0KG2nWPRuRjAklycgp12Un9jFLhDstMFwRKWaBmR8aItvnaNYg28r7mpYYYgvgS/QzvyjGFVg==
- Thread-topic: Permission Denied trying to connect to localhost in unit test
I am writing a command line application in Objective-C that needs to make a TCP
connection to a server. In a unit test for the TcpClient class I am writing, I
have a simple TCP server that listens for connections in a thread. When I try
to connect to this socket from the client socket class, connect() fails and
perror reports Permission Denied. I've added NSLog statements to show that the
server thread is up and ready to accept connections before the client socket
attempts to connect. Both the server and the client are using plain UNIX-style
sockets.
In the same project, I have a similar test case that creates a UDP server that
broadcasts messages, and the class being tested by that test case is able to
receive those messages. Also, if I modify the test for the Tcp Client to
simply let the server run for 30 seconds, I can connect to it with Telnet
(running unprivileged within Terminal).
My operating system is Mojave, and I created the project in XCode (v11.3) using
the Command Line Tool template. I then added a target using the Unit Testing
Bundle to create the unit tests.
Does anyone know what I might need to do to get this working?
Thanks!
Rob
Robert Walsh
EnvisionWare, Inc.
http://www.envisionware.com
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden