Skip to content

Commit

Permalink
update AsyncClient for add method of connectToHost:port:
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric.Zhou committed Sep 24, 2020
1 parent 4a9d150 commit 7a8009a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 7a8009a

Please sign in to comment.