質問するログイン新規登録

質問編集履歴

5

文章修正しました。

2019/08/28 13:51

投稿

goemon12
goemon12

スコア18

title CHANGED
File without changes
body CHANGED
@@ -1,7 +1,19 @@
1
1
  SwiftのNetwork.Frameworkで質問です。
2
2
  設定済みの接続先を変更するにはどうするべきですか?
3
3
 
4
+ ```
4
- let connection = NWConnection(host: port: using:)
5
+ connection = NWConnection(host: "127.0.0.1", port: 9600, using: .tcp)
6
+
7
+ connection.stateUpdateHandler = { state in
8
+ switch state {
9
+ case .ready:
10
+ print("接続しました")
11
+ default:
12
+ print("切断しました")
13
+ }
14
+ }
15
+ let queue = DispatchQueue(label: "label")
5
- connection.start(label:)
16
+ connection.start(queue: queue)
17
+ ```
6
18
 
7
- 接続済みのconnectionを一旦切断してhost変更して再接続する手順教えください
19
+ 様にIPアドレスとポートNOでconnection生成するのですけど設定画面でIPアドレスとポート番号を設定変更する方法探します

4

2019/08/28 13:51

投稿

goemon12
goemon12

スコア18

title CHANGED
File without changes
body CHANGED
File without changes

3

2019/08/28 02:14

投稿

goemon12
goemon12

スコア18

title CHANGED
File without changes
body CHANGED
@@ -2,4 +2,6 @@
2
2
  設定済みの接続先を変更するにはどうするべきですか?
3
3
 
4
4
  let connection = NWConnection(host: port: using:)
5
- connection.start(label:)
5
+ connection.start(label:)
6
+
7
+ 接続済みのconnectionを一旦切断して、host変更して再接続する手順を教えてください。

2

2019/08/28 02:10

投稿

goemon12
goemon12

スコア18

title CHANGED
File without changes
body CHANGED
@@ -1,4 +1,5 @@
1
1
  SwiftのNetwork.Frameworkで質問です。
2
2
  設定済みの接続先を変更するにはどうするべきですか?
3
3
 
4
- let connection = NWConnection(host: port:
4
+ let connection = NWConnection(host: port: using:)
5
+ connection.start(label:)

1

2019/08/28 02:06

投稿

goemon12
goemon12

スコア18

title CHANGED
File without changes
body CHANGED
@@ -1,2 +1,4 @@
1
1
  SwiftのNetwork.Frameworkで質問です。
2
- 設定済みの接続先を変更するにはどうするべきですか?
2
+ 設定済みの接続先を変更するにはどうするべきですか?
3
+
4
+ let connection = NWConnection(host: port: