Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Sending notification commands to Windows Forms application over a network

Posted on 2011-09-04
7
581 Views
Last Modified: 2012-05-12
Dear experts,

I've developed a web application wherein an admin assigns certain tasks to users registered in the application.

What I want to do is this:
Each user will run a desktop application (it is only minimized in the taskbar) that listens to the web application for task that is assigned to him.

Example:

Admin assigns task to user A through web app. User A immediately gets notified (a balloon pops-up from the taskbar icon) of the task that is assigned to him.


I assume I will need to send message directly to the IP address with port to the user? Do I have to open some sort of TCP client on the windows forms application? Though, I'm not sure.

Also, how do I send the messages from the web app to the windows forms app?

Please point me in the right direction.
0
Comment
Question by:the_7th_king
7 Comments
 
LVL 16

Expert Comment

by:Easwaran Paramasivam
ID: 36482697
As far I know direct communication from web to windows application could not be done. You can communicate through following way:

  1 . Write message from web application intermediate storage such as MSMQ, or a Flat file or store in database based on your requirement.
  2. Read the message from the intermediate storage to your windows applicaton.

0
 
LVL 2

Author Comment

by:the_7th_king
ID: 36482741
what about methods of tcpclient or something?
0
 
LVL 15

Expert Comment

by:x77
ID: 36482763
When you use Tcp,  client need suscribe to server an server anotate each client Ip Address to send notifications.

There are also other protocol. Udp supports Broadcast.
On a LAN, a program can send a message to a Ip Mask. All client receive the message depending on Ip mask.
Note that with UDP (On LAN only) you do´nt need anotate client Ip to send notifications.

Udp works also with WAN, but broadcast is limited to a ip list.

Udp protocol allow send messages without connect. But reception is not granted.
Message length is limited (512 to 1024 bytes depending on network configuration).
Mesage reception order is not granted on UDP.
0
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 
LVL 16

Accepted Solution

by:
Easwaran Paramasivam earned 500 total points
ID: 36482775
0
 
LVL 40
ID: 36482960
A Web service with a custom event. The application subscribes to the event. The administrator calls a method that triggers the event, passing the task in the EventArgs parameter.

A fast search for "Web Service Event" (http://www.bing.com/search?q=web+service+event&go=&qs=n&sk=&form=QBLH&filt=all) will show you different ways you could set up a Web service event.
0
 

Expert Comment

by:mkuzman
ID: 36483115
Having a push based notification scheme over TCP may not be the best idea.  If the client is offline, and you want to have some sort of guarantee that a notification was received, then your TcpServer will need to cache notifications (let alone the requirement to know what users are on which IPs).

I would do this the other way around - leveraging the fact that you already have a working  HTTP transport (web server).

So...  Client contacts Web Server via Web Service Call every now and then, with a NotificationRequest({from user}).  Web Service responds with NotificationResponse (for the requested user) - it may be the Notification (or a collection of notifications, if the client has been offline for a while), or nothing at all (if there are no notifications pending).

Your desktop client then only needs to create a WebRequest (instead of being a full-blown TcpClient).
http://msdn.microsoft.com/en-us/library/system.net.webrequest.aspx

Bootnote:  If you are using Windows Authentication in IIS then your Web Method doesn't need to accept a "{from user}"-type parameter.  It can infer from current HttpContext (User.Identity)
eg.
[WebMethod]
public NotificationResponse[] NotificationRequest() {

   string userName = HttpContext.User.Identity.Name;
   ...

}
0
 
LVL 2

Author Closing Comment

by:the_7th_king
ID: 36707681
thanks!
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question