1

学校の宿題で、スケルトンプログラムを与えられました。このプログラムは、サーバー モードとクライアント モードの両方で実行できます。

When run in server mode the program takes input from std::cin and outputs to std::cout
When run in client mode the program takes input from std::cin and outputs to std::cout

私がやりたいのは、C++コードを使用してそれらを一緒にパイプすることです(ただし、別の質問で名前付きパイプを使用して「Windows」でパイプする方法も尋ねています)

だから私は次のようなことを考えていました:

std::iostream server_input_client_output, server_output_client_input
start server in a thread Server(server_input_client_output, server_output_client_input)
start client in main thread Client(server_output_client_input, server_input_client_output)

スケルトン プログラム全体を書き直すつもりはありません。双方向のリアルタイム通信を可能にする有効な入力をサーバーとクライアントに提供したいだけです。

誰でも知っていますか?ありがとう。

4

0 に答える 0