Need concept regarding windows based chat application - c#

suppose if i want to develop a windows chat application then a chat server need be developed and client too. after developing chat server apps we can run that apps in a machine and chat client will be running another pc. if those pc is not in same network suppose chat server run in a USA machine and one chat client run in Germany machine and another run in UK machine. in this situation how communication will happen using internet. all the nachine have access internet so how one chat client will login to chat server and how two chat client will communicate with each other. i just want to how data will transfer from one client to another client via chat server. please give me concept or it would be better if anyone give me a reference of a any good .net based chat application where chat server and chat client will be there.........thanks.

Generally? I don't see how this is related to C#, but client-server architecture looks like this:
Client <-----> Server
For something like you're describing where two or more clients communicate with each other, you're just talking about adding multiple clients:
Client A <----
|
----> Server
|
Client B <----
If Client A wants to send a message to Client B, then Client A sends the message to the server with some sort of information indicating that it's intended for Client B. The server then examines the message, determines that it's intended for Client B, then relays that message over its connection to Client B.
This is the fundamental definition of client-server architecture. There are more advanced architectures that mix client-server with peer-to-peer, such as Skype. In a hybrid system, the connection from the client to the server typically only carries control messages (authentication, etc.) and requests for information on how to contact another client directly. The advantage to an approach like this is that it doesn't require all of the communication between A and B to flow through the server; A and B both connect to the server, but they then ask the server how to connect to each other directly, then use that direct connection for the bandwidth-intensive communication.
That's all an aside, really, though. You should read up on client-server architecture independent of any particular language or environment before you start down the road of developing an application.

WCF Web Service with the client polling the service (simple-basic scenario - easy to implement, not very efficient)
WCF Duplex Web Service with the server updating clients when needed (a bit more complicated)
TCP Socket-based solution, hardest to implement but permits much better control. There is a very good example in Matthew McDonald's book "Pro Silverlight 3"

Related

Event server for .net

I've a winform app that is connected to a sql server database and there are many pc client with the application installed. A standard desktop client/server application.
I want that a single client can communicate with all others, for example I want the administrator cand send a message to all clients. Something like SignalR fir asp.net.
I do not want that is the client that ask to database if there are messages, I want that all clients connects to a service that raise events like broadcast message or chat.
I prefer not to install something that needs a web server, but I will consider all your suggestions. Also I'd like to know if there is a specific name to this functionality so I can do a more accurate search.
thanks to all

Two-way Communication between Server and Clients

Situation: We have a web application running on a server. This application needs to fetch data from some other PC(Clients), which are on a different network.
On the clients' pc there are WCF hosted in Windows Services using its their local Sql db. i want to make duplex communication between server and clients for share data with each other.
data share mean share data-table,data-set,string etc between clients and server .
Problem :
1) I have no control over the firewall, proxy, NAT on the client side PC. Mostly company Employee PCs have lots of network security e.g firewall block ICMP traffic and some port too, some Router might be Disabled port-forwarding etc etc , client can change network place.
I don't want to make any setting on client side Router,proxy,firewall though .
during communication how can i handle that's kind of issue of client side?
as you know skype is working perfect in that situation.
firewalls very often block inbound connections to clients; the client may not be reachable from the server, it may be using NAT translation behind a router and so cannot be contacted without port forwarding being set up on the router and some new router disabled port forwarding .
2) On clients side there is no IIS .
I don't want to allow remote access on clients PC.
There are more than 100 Clients and only one Server. one server need communicate with many clients on different network .
3) One side my client application is using window application and wcf hosted in window service ,Other side on my server i'm using Web application . so its mean communication is between desktop pc and web pc , that's issue .
If both using a web application then it was not issue to make duplex communication.because i know WEBRTC is fit there lol.
Technology which i had already test and find issue
WSDualHttpBinding: Not work if client behind NAT. check this for detail click here
MSMQ : its bad technique if clients more than 1 and performance issue also because its use RAM memory . check here click here
Xsocket: Its also not work if ICMP traffic block by firewall on client. check here click
WebRTC: Its work fine but its support web to web communication .as my client side i have win app.
Socket.io: Its need to set up node.js and many other thing , hard to implement because i need implement on existence application , i am not making new application.
C# Socket Program: Its wouldn't work if client behind NAT.check here click for detail
Service Bus relay: Its not free even for testing .
socketPro: I studied i find its good but i can't find any right sample on google .so that i could test that.
Genuine Channels: I can't find any sample on google .
Lets see SignalR issue .: Server side i run a console application and Client side i run two application ,one is console and other web. when i was running console client application than it was not initiating connection with Server but when i was using web client application then it was working fine.
sample link is here SignalR two way communication
I can't understand why thas??
Please tell me What is best most secure and fast way to handle this situation? what approach should i use ?
SignalR seems to fit for this solution, because it's flexible.
It negotiates the fastest available channel of communication and that is what you are looking for.
You should investigate the problem with it and signalR will eventually work.
I'm using SignalR extensively to communicate between the servers (C#), between server and mobile apps (C#, Xamarin, iOS, Android). The servers are at different locations and the mobile apps can be anywhere. It all works very reliable.
Take a look at: http://www.asp.net/signalr/overview/deployment/tutorial-signalr-self-host and here http://www.asp.net/signalr/overview/guide-to-the-api/hubs-api-guide-net-client
I've been working in my spare time with sockets (admittedly in c++, not c# but there shouldn't be a difference), and I've never had an issue connecting to clients behind a firewall/router, even without port forwarding.
Routers and firewalls generally don't like server-like programs, eg. programs that bind the socket to a port number. Does your client do anything related to binding? Because it shouldn't.
Needless to say, I would suggest a socket program. The way I see it, it's the most flexible way.

Client Server 24/7 Listner

We want to implement a client server application. here is the scenario.
Server listens for client 24/7.
Server accept request for client and save it in DB for further process.
Once processing is done (it may take few hours), Server will response back to client.
in short , client and server listens for each other 24/7.
I want to implement it in C# but i also want that it should be accessibly from all platforms.
Also is it possible in WCF?
I agree with Yuck, this is a basic WCF scenario. There a few articles, videos and tutorials to get you started here http://msdn.microsoft.com/en-us/netframework/dd939784

Web application client server

I want to create a client/server web application. The client and server can exchange data back and forth. When i say data i mean like a number, for example (0,8,7...), so everytime a client presses a button it sends a number to the server and the server send an acknowledgement back to client. The cleint side i want to put it on the internet so you can access the server from a browser.
Is silverlight socket the way to go? I know theres port restrictions but im planning on using my personal router to open up the ports. Or is socket only for local connections???
Assuming you just have no idea where to start, I'd say you should start by learning about WCF (Windows Communication Foundation). Obviously, start with the beginner's guide. There are some nice introductory videos there that should get you going.
If there is such a thing as Silverlight sockets, you can use them. I'd rather use WCF. Sockets aren't restricted to local connections, but you should be aware that using ports different from 80 in Web applications can restrict some user from accessing your them.
I would like to add that sockets aren't the fastest local connections, but are the base of almost all inter-machine communication.

How to build a messaging system in .NET?

I'd like to write a program where you can have 2 clients that talk to each other in realtime. I've been looking into WCF services and Duplex messaging, data contracts etc but now I'm confused.
Basically I see it as:
[Client] --- msg --> [Server] --- msg --> [Client] and vica versa.
The server will just act as the messenger.
Could you please point me in the right direction? I'd like to use WPF for the client apps.
Check out the WCF peer-to-peer programming paradigm. It will be extended in WCF 4 (with .NET 4 - due out April 12, 2010) by allowing dynamic discovery (and article here) of other clients on your network.
This should help get you going: WCF / WPF Chat Application
Perhaps Windows Azure Service Bus (which uses WCF) might be worth a look?
Service bus can effectively be used as a message bus, which is one way to implement what you are describing.
I can think of two scenarios
The clients are the only ones that start a request, to send they push messages and to receive they request periodically for new messages. The main advantage of this architecture is that it is more firewall-proof.
The clients are also servers that receive messages relayed by the central server. The main advantage is that the clients receive updates faster and they save bandwidth.
I wrote program like your sample!!!
but it has one big different: My program have a chat server and a client. clients can chat to others.(with chat server service)
This program use two wcf service for make a connection between client and server.(client call server and send message for it,server get message from client and send for all client have connected to server)I think u used one service and must be use two service(like me) or use Duplex Service.
The sucha barber`s example is too cool(WCF/WPF Chat Application in answer eric). He used duplex services but real problem of this example is "sucah used WPF too and it s expert example for beginners (like me and u)".
If u want i can share my program!!!
seethis

Categories