Martin
Martin

Reputation: 24316

Creating a XMPP chat application with UDP or TCP with .net

I am trying to create a chat application in .net but I am confused whether to use TCP or UDP.

There will be many users, each user need to send a message to the main server which will relay this message to the user. If the user is not online I would need to store the message for later sending.

Of course each message that I send needs to contain the message content, type and the user who wishes to deliver it. I was thinking about using XMPP as the transport layer for performing this.

The server needs to accept connections from many clients.

Each client needs to connect to the server, would they use the same port?

Upvotes: 0

Views: 1668

Answers (3)

Alex
Alex

Reputation: 4136

XMPP would be a good choice for your project.

Goto http://xmpp.org/xmpp-software/libraries/ and find a .NET library. All of them ship with sample code.

For your firsts tests you can either use a public server, your Gmail id or download and install one of the servers listed here: http://xmpp.org/xmpp-software/servers/

Upvotes: 1

Oofpez
Oofpez

Reputation: 514

I've done this before with TCP and it was mostly straightforward. I used the same port for all the clients to connect, with the server listening on that port with a thread that served the clients in a queue and assigned their connections.

UDP works as well as TCP but involves extra work to ensure that your data is not lost randomly.

Upvotes: 0

David Brabant
David Brabant

Reputation: 43609

What about web sockets?

Upvotes: 0

Related Questions