Skip to content

Commit 64c411a

Browse files
committed
Adding GCDAsyncUdpSocket
1 parent a87a901 commit 64c411a

File tree

25 files changed

+14390
-900
lines changed

25 files changed

+14390
-900
lines changed

GCD/GCDAsyncUdpSocket.h

Lines changed: 689 additions & 0 deletions
Large diffs are not rendered by default.

GCD/GCDAsyncUdpSocket.m

Lines changed: 5050 additions & 0 deletions
Large diffs are not rendered by default.

GCD/Xcode/EchoServer/EchoServer.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@
125125
29B97317FDCFA39411CA2CEA /* Resources */ = {
126126
isa = PBXGroup;
127127
children = (
128+
1DDD58140DA1D0A300B32029 /* MainMenu.xib */,
128129
8D1107310486CEB800E47090 /* EchoServer-Info.plist */,
129130
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
130-
1DDD58140DA1D0A300B32029 /* MainMenu.xib */,
131131
);
132132
name = Resources;
133133
sourceTree = "<group>";

GCD/Xcode/EchoServer/EchoServerAppDelegate.m

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,21 @@ - (id)init
3333
if((self = [super init]))
3434
{
3535
// Setup our logging framework.
36-
// Logging isn't used in this file, but can optionally be enabled in GCDAsyncSocket.
36+
3737
[DDLog addLogger:[DDTTYLogger sharedInstance]];
3838

39-
// Setup our server socket (GCDAsyncSocket).
39+
// Setup our socket.
4040
// The socket will invoke our delegate methods using the usual delegate paradigm.
4141
// However, it will invoke the delegate methods on a specified GCD delegate dispatch queue.
4242
//
43-
// Now we can setup these delegate dispatch queues however we want.
44-
// Here are a few examples:
45-
//
46-
// - A different delegate queue for each client connection.
47-
// - Simply use the main dispatch queue, so the delegate methods are invoked on the main thread.
48-
// - Add each client connection to the same dispatch queue.
43+
// Now we can configure the delegate dispatch queues however we want.
44+
// We could simply use the main dispatc queue, so the delegate methods are invoked on the main thread.
45+
// Or we could use a dedicated dispatch queue, which could be helpful if we were doing a lot of processing.
4946
//
5047
// The best approach for your application will depend upon convenience, requirements and performance.
5148
//
52-
// For this simple example, we're just going to share the same dispatch queue amongst all client connections.
49+
// For this simple example, we're just going to use the main thread.
5350

54-
socketQueue = dispatch_queue_create("SocketQueue", NULL);
5551
listenSocket = [[GCDAsyncSocket alloc] initWithDelegate:self delegateQueue:socketQueue];
5652

5753
// Setup an array to store all accepted client connections
@@ -133,7 +129,7 @@ - (IBAction)startStop:(id)sender
133129
{
134130
int port = [portField intValue];
135131

136-
if(port < 0 || port > 65535)
132+
if (port < 0 || port > 65535)
137133
{
138134
[portField setStringValue:@""];
139135
port = 0;

0 commit comments

Comments
 (0)