Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
Roger #1
Member since Mar 2011 · 8 posts
Group memberships: Members
Show profile · Link to this post
Subject: how does XMPP listen to incoming messages?
Hello,
I am learning WCF right now and was wondering, how does XMPP listen to incoming messages?
Since to make a WCF application act as a server, i.e. listen to incoming requests, user has to run it in administrative mode, allow it to pass through the firewall and even configure port-forwarding, if he is behind a router.

While XMPP applications listen to incoming messages without the hassle above. Could you please explain, how it is done?

Thanks!
Avatar
Alex #2
Member since Feb 2003 · 4307 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
A XMPP connection is a long lived tcp socket connection initiated by the client. The connection is used for outgoing and incoming stanzas (messages). So both the client and the server can send and receive messages asynchronous at any time.

Because the client opens the connection to the server firewalls are normally no problem. Most firewalls block only incoming connections.
Avatar
Roger #3
Member since Mar 2011 · 8 posts
Group memberships: Members
Show profile · Link to this post
Thanks for your explanation!
Maybe you could please point me to some tutorials that would explain this process? Can it be done using WCF or 'tcp socket connection' is something different?

Thanks again!
Avatar
Alex #4
Member since Feb 2003 · 4307 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
XMPP is a realtime messaging protocol. WCF is also a messaging protocol/framework. You can either use XMPP or WCF, but a combination of both makes no sense to me.

When you decide on xmpp (which is a good choice ;-)) then you don't have to bother yourself with socket and the protocol. Add a referece to MatriX, agsXMPP or any other XMPP library and use it like you use WCF with the classes of the .NET framework.

To learn more about XMPP is suggest the book which is advertised belog and the webpages of the XMPP Standards Foundation.
Avatar
Roger #5
Member since Mar 2011 · 8 posts
Group memberships: Members
Show profile · Link to this post
no, I wasn't going to use both of the at the same time. XMPP is truly great for chat-like messaging, but I more like need to make an application that would be able to send and receive asynchronous service messages ( like "add to database that and that" ) between two machines. Preferably directly machine-to-machine, rather then machine-server-machine as it is done in xmpp.

so I was wondering, can such connection ( machine-to-machine, without any problems with a firewall, port forwarding, etc. ) be established using wcf or is this 'long lived tcp socket connection' done somehow else?

Thanks!
Avatar
Alex #6
Member since Feb 2003 · 4307 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
no, you are wrong, XMPP is much more than only a chat protocol. Most people know it only as a chat protocol, but its much more.

Here you can find a very small overview of the capabilities of XMPP:
http://fyi.oreilly.com/2009/05/what-can-you-do-with-xmpp.h…
Avatar
Roger #7
Member since Mar 2011 · 8 posts
Group memberships: Members
Show profile · Link to this post
Yes, I know XMPP is very powerful!
Thanks to your library I even made a program from listing files on a remote computer, etc.

[Image: http://s50.radikal.ru/i130/1104/6d/223ed2335ed6.jpg]

But I am wondering if it is possible to do the same, without a central server?
So that messages would go directly from one computer to the other, without the need of a server.

p.s. or am I missing something and machine-to-machine messages also can be send using xmpp?
Avatar
Alex #8
Member since Feb 2003 · 4307 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
By default XMPP is always server based. But there is an extension Serverless Messaging which uses XMPP peer to peer. But this extension is not supported in agsXMPP.

With Serverless Messaging you will run again into firewall issues, because clients must accept incoming connections which are blocked.
Avatar
Roger #9
Member since Mar 2011 · 8 posts
Group memberships: Members
Show profile · Link to this post
Thanks again for the reply and sorry for still bothering you. :)
But if regular xmpp client can receive asynchronous ( incoming ) messages, doesn't it mean it is acting like a server?

EDIT: Aha, looks like I've got it. :) putting it simple, server can receive any incoming traffic, while a client can open a specific long term connection to the server and receive asynchronous messages only using this connection, right?
This post was edited on 2011-04-08, 13:58 by Roger.
Avatar
Alex #10
Member since Feb 2003 · 4307 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
A socket is always able to send and receive data asynchronous at any time when it keeps the connection open. And this is exactly what XMPP is doing. Other protocols like HTTP always poll a server and then close the socket. Polling sucks, XMPP rocks ;-)

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