Skip to content

Commit 92641b5

Browse files
authored
Merge pull request #1 from ZhouYangSimple/master
update AsyncClient for add method of connectToHost:port:
2 parents 4a9d150 + 7a8009a commit 92641b5

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

AsyncNetwork.xcodeproj/xcshareddata/xcschemes/AsyncNetwork iOS.xcscheme

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<BuildableReference
1616
BuildableIdentifier = "primary"
1717
BlueprintIdentifier = "2DA5F1161AB5FABE00A8A65F"
18-
BuildableName = "AsyncNetwork iOS.framework"
18+
BuildableName = "AsyncNetwork.framework"
1919
BlueprintName = "AsyncNetwork iOS"
2020
ReferencedContainer = "container:AsyncNetwork.xcodeproj">
2121
</BuildableReference>
@@ -29,8 +29,6 @@
2929
shouldUseLaunchSchemeArgsEnv = "YES">
3030
<Testables>
3131
</Testables>
32-
<AdditionalOptions>
33-
</AdditionalOptions>
3432
</TestAction>
3533
<LaunchAction
3634
buildConfiguration = "Debug"
@@ -46,13 +44,11 @@
4644
<BuildableReference
4745
BuildableIdentifier = "primary"
4846
BlueprintIdentifier = "2DA5F1161AB5FABE00A8A65F"
49-
BuildableName = "AsyncNetwork iOS.framework"
47+
BuildableName = "AsyncNetwork.framework"
5048
BlueprintName = "AsyncNetwork iOS"
5149
ReferencedContainer = "container:AsyncNetwork.xcodeproj">
5250
</BuildableReference>
5351
</MacroExpansion>
54-
<AdditionalOptions>
55-
</AdditionalOptions>
5652
</LaunchAction>
5753
<ProfileAction
5854
buildConfiguration = "Release"
@@ -64,7 +60,7 @@
6460
<BuildableReference
6561
BuildableIdentifier = "primary"
6662
BlueprintIdentifier = "2DA5F1161AB5FABE00A8A65F"
67-
BuildableName = "AsyncNetwork iOS.framework"
63+
BuildableName = "AsyncNetwork.framework"
6864
BlueprintName = "AsyncNetwork iOS"
6965
ReferencedContainer = "container:AsyncNetwork.xcodeproj">
7066
</BuildableReference>

AsyncNetwork/AsyncClient.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
- (void)stop;
6161

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

6465
- (void)sendCommand:(AsyncCommand)command object:(id<NSCoding>)object responseBlock:(AsyncNetworkResponseBlock)block;
6566
- (void)sendCommand:(AsyncCommand)command object:(id<NSCoding>)object;

AsyncNetwork/AsyncClient.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,16 @@ - (void)connectToService:(NSNetService *)service
118118
[self.connections addObject:connection];
119119
}
120120

121+
- (void)connectToHost:(NSString *)theHost port:(NSUInteger)thePort
122+
{
123+
// create and configure a connection
124+
// the connection takes care of resovling the net service
125+
AsyncConnection *connection = [AsyncConnection connectionWithHost:theHost port:thePort];
126+
connection.delegate = self;
127+
[connection start];
128+
[self.connections addObject:connection];
129+
}
130+
121131
// send object to all servers
122132
- (void)sendCommand:(AsyncCommand)command object:(id<NSCoding>)object responseBlock:(AsyncNetworkResponseBlock)block;
123133
{

0 commit comments

Comments
 (0)