掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
boost::asioでTCPクライアントサーバーの構築をしたいのですが…… (ID:70019)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
初めまして。 asioでクライアントサーバーシステムを構築しようと思い、いろいろやってみましたがうまくいきません 〜以下コード(クライアント側)〜 ip::address addr=ip::address::from_string("192.168.1.12"); tcp::iostream s(tcp::endpoint(addr, 10800)); while(mred==0) { s << "allow"; s<<send<<flush; s.close(); mred=1; } while(mred==1) { getline(s, line); { cout << line << recv << endl; } } 〜以下コード(サーバー側)〜 ip::tcp::acceptor acc(io, ip::tcp::endpoint(ip::tcp::v4(), 10800)); for (;;) { // 接続待ち ip::tcp::iostream s; acc.accept(*s.rdbuf()); while (getline(s, line)) { cout << line << endl; } s <<"123"; s <<flush; s<<send<<endl; } 〜終了〜 症状的には 1.サーバーには届いている模様。 2.ただし文字がallowだけでなく色々付与されている。 3.クライアント側には帰ってこない。 ……となっています。 グーグルさん等に聞いて試行錯誤したのですがよくわからないですし、可也困っているので宜しくお願いします。
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2020 Takeshi Okamoto All Rights Reserved.