2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

UWPでStreamSocketListener使ったときにテストできなかった話

Posted at

UWPアプリの通信部分を作っているときにちゃんとつながるかテストしようとした。

1時間ほど調べた結果としてテストできないらしいことが分かった。

使用したコード

サーバー側

 int port = 5555;
 HostName ip = new HostName("127.0.0.1");

 Task.Run(async () =>
 {
    StreamSocketListener streamsocketlistener = new StreamSocketListener();
    streamsocketlistener.ConnectionReceived += ConnectionReceived;

    await streamsocketlistener.BindEndpointAsync(ip, port.ToString());
                
 });

クライアントはtelnet

原因

Stack Overflowで有力そうな記事を見つけた

「同じコンピュータ内で実行されている別のアプリケーションまたはプロセスからStreamSocketListenerに接続することはできません」

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?