Skip to content

Commit

Permalink
Merge pull request #1 from ZhouYangSimple/master
Browse files Browse the repository at this point in the history
update AsyncClient for add  method of connectToHost:port:
  • Loading branch information
levey committed Sep 24, 2020
2 parents 4a9d150 + 7a8009a commit 92641b5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
Expand Up @@ -15,7 +15,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2DA5F1161AB5FABE00A8A65F"
BuildableName = "AsyncNetwork iOS.framework"
BuildableName = "AsyncNetwork.framework"
BlueprintName = "AsyncNetwork iOS"
ReferencedContainer = "container:AsyncNetwork.xcodeproj">
</BuildableReference>
Expand All @@ -29,8 +29,6 @@
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -46,13 +44,11 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2DA5F1161AB5FABE00A8A65F"
BuildableName = "AsyncNetwork iOS.framework"
BuildableName = "AsyncNetwork.framework"
BlueprintName = "AsyncNetwork iOS"
ReferencedContainer = "container:AsyncNetwork.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand All @@ -64,7 +60,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2DA5F1161AB5FABE00A8A65F"
BuildableName = "AsyncNetwork iOS.framework"
BuildableName = "AsyncNetwork.framework"
BlueprintName = "AsyncNetwork iOS"
ReferencedContainer = "container:AsyncNetwork.xcodeproj">
</BuildableReference>
Expand Down
1 change: 1 addition & 0 deletions AsyncNetwork/AsyncClient.h
Expand Up @@ -60,6 +60,7 @@
- (void)stop;

- (void)connectToService:(NSNetService *)service;
- (void)connectToHost:(NSString *)theHost port:(NSUInteger)thePort;

- (void)sendCommand:(AsyncCommand)command object:(id<NSCoding>)object responseBlock:(AsyncNetworkResponseBlock)block;
- (void)sendCommand:(AsyncCommand)command object:(id<NSCoding>)object;
Expand Down
10 changes: 10 additions & 0 deletions AsyncNetwork/AsyncClient.m
Expand Up @@ -118,6 +118,16 @@ - (void)connectToService:(NSNetService *)service
[self.connections addObject:connection];
}

- (void)connectToHost:(NSString *)theHost port:(NSUInteger)thePort
{
// create and configure a connection
// the connection takes care of resovling the net service
AsyncConnection *connection = [AsyncConnection connectionWithHost:theHost port:thePort];
connection.delegate = self;
[connection start];
[self.connections addObject:connection];
}

// send object to all servers
- (void)sendCommand:(AsyncCommand)command object:(id<NSCoding>)object responseBlock:(AsyncNetworkResponseBlock)block;
{
Expand Down

0 comments on commit 92641b5

Please sign in to comment.