質問編集履歴
5
文章修正しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -4,10 +4,34 @@
|
|
4
4
|
|
5
5
|
|
6
6
|
|
7
|
-
|
7
|
+
```
|
8
8
|
|
9
|
+
connection = NWConnection(host: "127.0.0.1", port: 9600, using: .tcp)
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
connection.stateUpdateHandler = { state in
|
14
|
+
|
15
|
+
switch state {
|
16
|
+
|
17
|
+
case .ready:
|
18
|
+
|
19
|
+
print("接続しました")
|
20
|
+
|
21
|
+
default:
|
22
|
+
|
23
|
+
print("切断しました")
|
24
|
+
|
25
|
+
}
|
26
|
+
|
27
|
+
}
|
28
|
+
|
29
|
+
let queue = DispatchQueue(label: "label")
|
30
|
+
|
9
|
-
connection.start(
|
31
|
+
connection.start(queue: queue)
|
32
|
+
|
33
|
+
```
|
10
34
|
|
11
35
|
|
12
36
|
|
13
|
-
|
37
|
+
この様にIPアドレスとポートNOでconnection生成するのですけど、設定画面でIPアドレスとポート番号を設定変更する方法を探してます。
|
4
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|
3
test
CHANGED
File without changes
|
test
CHANGED
@@ -7,3 +7,7 @@
|
|
7
7
|
let connection = NWConnection(host: port: using:)
|
8
8
|
|
9
9
|
connection.start(label:)
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
接続済みのconnectionを一旦切断して、host変更して再接続する手順を教えてください。
|
2
test
CHANGED
File without changes
|
test
CHANGED
@@ -4,4 +4,6 @@
|
|
4
4
|
|
5
5
|
|
6
6
|
|
7
|
-
let connection = NWConnection(host: port:
|
7
|
+
let connection = NWConnection(host: port: using:)
|
8
|
+
|
9
|
+
connection.start(label:)
|
1
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,3 +1,7 @@
|
|
1
1
|
SwiftのNetwork.Frameworkで質問です。
|
2
2
|
|
3
3
|
設定済みの接続先を変更するにはどうするべきですか?
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
let connection = NWConnection(host: port:
|