Not logged in. · Lost password · Register
Forum: agsXMPP RSS
writing server
Avatar
IrQ #1
Member since Oct 2010 · 6 posts
Group memberships: Members
Show profile · Link to this post
Subject: Using agsXMPP.protocol.stream in server
Hello! I have three questions for you.

1) sample server has this code:

private void SendOpenStream()
{
      this.SessionId = agsXMPP.SessionId.CreateNewId();
           
      StringBuilder sb = new StringBuilder();

      sb.Append( "<stream:stream from='");
      sb.Append( "localhost );
           
      sb.Append( "' xmlns='" );
      sb.Append( agsXMPP.Uri.CLIENT );
           
      sb.Append( "' xmlns:stream='" );
      sb.Append( agsXMPP.Uri.STREAM );
         
      sb.Append( "' id='" );
      sb.Append( this.SessionId );
      sb.Append( "'>" );

      Send( sb.ToString() );
}

if i rewrite it using agsXMPP.protocol.stream.Stream, like

agsXMPP.protocol.stream.Stream s = new agsXMPP.protocol.stream.Stream();
s. From = new Jid("localhost");
this.SessionId = agsXMPP.SessionId.CreateNewId();
s.StreamId = this.SessionId;
Send(s);

the XML dump differs from something like
<stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' from='myjabber.net' id='1075705237'>
to something like that
<stream xmlns='jabber:client' xmlns='http://etherx.jabber.org/streams' from='myjabber.net' id='1075705237'>
Can I use this class for forming stream?

2) Second question is: Where and how I must send "stream:features" to client?
BTW, if I using class using agsXMPP.protocol.stream.feature.Features i have the same problem, like in list-item 1 (tag features instead stream:features)

3) What I should do to turn-on SASL/TLS steam encryption?

Thank you.
Avatar
Alex #2
Member since Feb 2003 · 4311 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by IrQ:
the XML dump differs from something like
<stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' from='myjabber.net' id='1075705237'>
to something like that
<stream xmlns='jabber:client' xmlns='http://etherx.jabber.org/streams' from='myjabber.net' id='1075705237'>
Can I use this class for forming stream?

the xml is in theory the same. Bioth tags are in the http://etherx.jabber.org/streams namespace. TheXml Dom in agsXMPP is not optimized for creating tags with prefixes. This is why I build the Stream as a string in the example. There may be client which expect stream:stream, even if it doesn't matter.

Quote by IrQ:
2) Second question is: Where and how I must send "stream:features" to client?
BTW, if I using class using agsXMPP.protocol.stream.feature.Features i have the same problem, like in list-item 1 (tag features instead stream:features)
directly after you send the stream header. See the examples the RFC

Quote by IrQ:
3) What I should do to turn-on SASL/TLS steam encryption?
advertise the TLs stream feature and switch to TLS on the socket when the client requests it. This is also described in the RFCs.

Alex
Avatar
IrQ #3
Member since Oct 2010 · 6 posts
Group memberships: Members
Show profile · Link to this post
There may be client which expect stream:stream, even if it doesn't matter.
I've tested on psi+. It doesn't working with no suffix tag.
advertise the TLs stream feature and switch to TLS on the socket when the client requests it. This is also described in the RFCs.
Are there any samples how to use it with agsXMPP classes?

Thank you.
Avatar
Alex #4
Member since Feb 2003 · 4311 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by IrQ:
Are there any samples how to use it with agsXMPP classes?
no, there does not happen much on the XMPP level. Its mostly related to sockets and SslStream. You can find SslStream examples for client and server in the MSDN.

Alex
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP RSS