2016-12-23 1 views
1

Unity에서 초보자이며 처음으로 Unity에서 XMPP를 구현했지만 서버와의 연결을 설정할 수 없습니다. 아래는 오류 로그 :SASL XMPP 인증이 <not-authorized>와 함께 실패했습니다.

다음
<stream:stream to='192.168.1.225' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' xml:lang='en'> 

<stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="daydate" xml:lang="en" id="80mu0xgew1" version="1.0" > 

<stream:features xmlns:stream="http://etherx.jabber.org/streams"><starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" /><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism><mechanism>ANONYMOUS</mechanism><mechanism>SCRAM-SHA-1</mechanism><mechanism>CRAM-MD5</mechanism><mechanism>DIGEST-MD5</mechanism></mechanisms><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression><auth xmlns="http://jabber.org/features/iq-auth" /><register xmlns="http://jabber.org/features/iq-register" /></stream:features> 

<starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" /> 

<proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" /> 

<stream:stream to='192.168.1.225' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' xml:lang='en'> 

<stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="daydate" xml:lang="en" id="80mu0xgew1" version="1.0" > 

<stream:features xmlns:stream="http://etherx.jabber.org/streams"><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism><mechanism>ANONYMOUS</mechanism><mechanism>SCRAM-SHA-1</mechanism><mechanism>CRAM-MD5</mechanism><mechanism>DIGEST-MD5</mechanism></mechanisms><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression><auth xmlns="http://jabber.org/features/iq-auth" /><register xmlns="http://jabber.org/features/iq-register" /></stream:features> 

<auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="DIGEST-MD5" /> 

<challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">cmVhbG09ImRheWRhdGUiLG5vbmNlPSJ0anpIMkhxMGJnRC9hVVdmNHAvZTNGaWdFYVpod0pHRGdzdkkrYXBPIixxb3A9ImF1dGgiLGNoYXJzZXQ9dXRmLTgsYWxnb3JpdGhtPW1kNS1zZXNz</challenge> 

<response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">dXNlcm5hbWU9InNhZ2FyIixyZWFsbT0iZGF5ZGF0ZSIsbm9uY2U9InRqekgySHEwYmdEL2FVV2Y0cC9lM0ZpZ0VhWmh3SkdEZ3N2SSthcE8iLGNub25jZT0iZjdmZmY5YjBmZDEwZGQ4ZGMxYWVhMzg2MDM2OTJmMzNkNDdjNGFlZWNhMTcwNzYwYzlhNmZlZjQwZjAyMmZmMCIsbmM9MDAwMDAwMDEscW9wPWF1dGgsZGlnZXN0LXVyaT0ieG1wcC8xOTIuMTY4LjEuMjI1IixjaGFyc2V0PXV0Zi04LHJlc3BvbnNlPTJkYWMyMDMxMDA2NDIxM2E3ZDBlOTFkMDUzYzQ1NjYx</response> 

<failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized /></failure> 

<failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized /></failure> 

</stream:stream> 

서버와의 연결을 설정하는 코드입니다

void Start() { 


    connection = new JUN.Connection(); 

    connection.Server = "192.168.1.225"; 
    connection.Port = 5222; 
    connection.Username = "username"; //Without @domainName 
    connection.Password = "password"; 

    connection.AutoRoster = true; 
    connection.AutoAgents = false; 
    connection.AutoPresence = true; 
    connection.AutoResolveConnectServer = false; 

    connection.SocketConnectionType = SocketConnectionType.Direct; 

    connection.OnReadXml += new XmlHandler(OnReadXml); 
    connection.OnWriteXml += new XmlHandler(OnWriteXml); 
    connection.OnLogin += delegate (object sender) { queue.Enqueue(() => OnLogin(sender)); }; 
    connection.OnClose += delegate (object sender) { queue.Enqueue(() => OnClose(sender)); }; 
    connection.OnError += new ErrorHandler(OnError); 
    connection.OnPresence += delegate (object sender, Presence pres) { queue.Enqueue(() => OnPresence(sender, pres)); }; 
    connection.OnMessage += delegate (object sender, Message msg) { queue.Enqueue(() => OnMessage(sender, msg)); }; 
    connection.OnAuthError += new XMPPElementHandler(OnAuthError); 
    connection.OnSocketError += new ErrorHandler(OnSocketError); 
    connection.OnStreamError += new XMPPElementHandler(OnStreamError); 

    connection.OnConnectionStateChanged += delegate (object sender, ConnectionState state) { queue.Enqueue(() => OnConnectionStateChanged(sender, state)); }; 
    connection.Open(); 

} 

내가이 문제를 직면하고 같은 문제가 많은 문서를 통해 이동하지만 모든 솔루션을받지 오전. Openfire 서버를 사용하고 있습니다.

도와주세요.

답변

1

XMPP 도메인은 요일이며 서버 속성에서 설정 한 IP가 아닙니다. 서버를 daydate로 설정하고 서버를 ip로 설정하십시오.

서버에 적합한 dns 및 SRV 레코드를 설정할 때 더 쉬워 질 것입니다. XMPP 도메인은 사용자 이름과 암호에 추가로 SASL 인증의 일부입니다.

+0

답장을 보내 주셔서 감사합니다.하지만이 방법도 작동하지 않습니다. – technerd

+0

그런 다음 새 로그를 추가하고 사용자 이름과 암호가 올바른지 확인하십시오. – Alex

+0

라이브 서버에서는 코드가 정상적으로 작동하지만 내 컴퓨터에서 생성 된 로컬 서버에서는 작동하지 않습니다. – technerd

관련 문제