libjingle을 사용하고 XMPP 서버에 로그온하는 첫 번째 단계에 문제가있는 코드를 작성하고 있습니다. 내 코드는 sample code from goog과 pcp 샘플 코드를 기반으로합니다. 이 코드는 하나의 스레드 만 실행하기 때문에 조금 혼란 스럽습니다. 그래서 이것은 매우 기본적인 질문입니다. 그래서 분명이 가져 오기에 붙어 점점libjingle을 사용하여 XMPP에 로그온하십시오.
connecting... received message: 0 1: 0 : 0 [004:722] Resolving addr in PhysicalSocket::Connect 2: 0 received message: 0 1: 0 : 0 2: 0
을 그리고 헹 (& 메시지 : 실행하면
talk_base::PhysicalSocketServer ss;
talk_base::AutoThread main_thread(&ss);
buzz::Jid jid(xmppUsername + "@" + xmppHost);
if (!jid.IsValid() || jid.node() == "")
throw "Invalid JID. JIDs should be in the form [email protected]" ;
buzz::TlsOptions tls = buzz::TLS_ENABLED;
buzz::XmppClientSettings xcs;
xcs.set_user(jid.node());
xcs.set_host(jid.domain());
xcs.set_resource("pcp");
xcs.set_pass(talk_base::CryptString(pass));
xcs.set_allow_plain(true);
xcs.set_server(talk_base::SocketAddress(xmppHost.c_str(), 5222));
xcs.set_use_tls(tls);
// Log in.
CustomXmppPump pump;
pump.client()->SignalLogInput.connect(&debug_log_, &DebugLog::Input);
pump.client()->SignalLogOutput.connect(&debug_log_, &DebugLog::Output);
pump.DoLogin(xcs, new XmppSocket(tls), 0);
// Wait until login succeeds.
std::vector<uint32> ids;
ids.push_back(MSG_LOGIN_COMPLETE);
ids.push_back(MSG_LOGIN_FAILED);
if (MSG_LOGIN_FAILED == Loop(ids))
throw "Failed to connect";
...
// Runs the current thread until a message with the given ID is seen.
uint32 Loop(const std::vector<uint32>& ids) {
talk_base::Message msg;
while (talk_base::Thread::Current()->Get(&msg)) {
cout << "received message: " << msg.message_id << endl;
if (msg.phandler == NULL) {
if (std::find(ids.begin(), ids.end(), msg.message_id) != ids.end())
return msg.message_id;
std::cout << "orphaned message: " << msg.message_id << endl;
continue;
}
cout << "1: " << msg.message_id << " : " << msg.ts_sensitive << endl;
talk_base::Thread::Current()->Dispatch(&msg);
cout << "2: " << msg.message_id << endl;
}
return 0;
}
, 그것은 출력 :
어쨌든, 여기에 고기와 내 코드의 감자입니다) 전화.
내 서버가 DNS SRV 레코드를 사용하고 다른 클라이언트와 잘 작동한다는 것을 알아야합니다. 아마도 SRV를 직접 해결할 필요가 있을까요?
도움 주셔서 감사합니다.
이 this bug, 내 자신의 테스트에 따르면, DNS의 SRV가 지원되지 않습니다
다른 사람들은이 경로를 따라 가기 위해 libjingle을 사용하여 XMPP를 통해 로그인하는 가장 최근의 방법에 대한 호출 예제를 살펴볼 것을 제안합니다. – Zack