开发者

Building a Login Server for a WPF desktop application

开发者 https://www.devze.com 2023-04-12 15:26 出处:网络
I\'m starting a pet project to see if I can create a friend list (like AIM/MSN/Skype/Steam) and am only focusing on getting the the online/offline notifications to work. My experience is C#, .NET, and

I'm starting a pet project to see if I can create a friend list (like AIM/MSN/Skype/Steam) and am only focusing on getting the the online/offline notifications to work. My experience is C#, .NET, and building Webforms and Winforms so I am also taking this as an opportunity to learn WPF which I know is a challenge but from what I've read in the end WPF will make this kind of project easier.

I'm interested in any input or suggestions that might help me or if I am overlooking anything, particularly when it comes to scaling.

Right now my design is to 开发者_如何学Chave a Client tell the Login Server that the UserName has logged on, along with the IP and the open port. (From my understanding the best way to do this is using a WCF web service on the Login Server?)

The login server then stores the UserName in a hashtable (will this scale?) and queries a friend list database for everyone who is friends with you, then checks that same hashtable for any of those friends that are online. When the login server has a hit in the hashtable it sends your information (name, Ip, port) to your friend's client (WCF again?) and then your friend's client sends your client information that the friend's client is online (WCF again?)

This is probably pretty simplistic but will this work?

Thanks in advance.


I have done this with .Net Remoting before.

  • Client and server share a common interface dll.
  • The client creates a server object (singleton) on the server and gets an IServer interface.
  • The client hands an IClient object to the IServer.
  • The server holds a currently connected list of IClient (periodic pings recommended).
  • The server can manipulate any IClient it wants (e.g. push notifications)
  • Server can act as a switchboard operator and hand IClient interfaces to each other (e.g., for a chat session)

I did this with a bidirectional channel (GenuineChannels) for performance (binary serialization), push notifications, and to get through firewalls (if the client is behind a firewall, the server cannot call back to them once the connection is broken).


======== Options ===========

.Net Remoting - Really hasn't changed since then - so this is still doable.

WCF callbacks - Didn't work through firewalls when I tried them, because they waited for the server to open a connection back and used two separate connections.
http://msdn.microsoft.com/en-us/magazine/cc163537.aspx

Azure Service Bus - The solution I think Microsoft wants you to consider these days http://www.microsoft.com/windowsazure/features/servicebus/

0

精彩评论

暂无评论...
验证码 换一张
取 消