Click here to Skip to main content
14,149,668 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
I have a web service hosted on my local machine which I have made as a web server and a client machine that consumes the web service.

Now when the web service is consumed by the client the web server should get notifications from the client at regular interval of time that the client is using the service and the server should also send a acknowedgement that it got the notification..

How should I implement this?
Posted
Updated 11-Apr-11 20:30pm
v4
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Erhm...
What do you want? In the header you say you want the server to send messages to the client, and in your question you say the client should send messages to the server¿?

Anyway, sending messages from a web service to a client is impossible without a client's request, you'll need to implement a different technique than a webservice. If you want the client to regularly send messages to the webservice, just use a Timer[^].

Good luck,
Eduard
   
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

You can use the the System.Net.Mail to send mail to your account, or put a function that will write into your log file. Then insert it to your specific service codeblock.

public void SendMail(string from, string to, string subject, string body) {
     MailMessage message = new MailMessage { Subject = subject, Body = body };
     SmtpClient smtp = new SmtpClient();
     smtp.Send(message);
}
   
Comments
edjeit 12-Apr-11 2:23am
   
Did anyone mention mail here?
Pong D. Panda 12-Apr-11 2:40am
   
You don't get my point here. He's using webservice, so I expect he knows the limitations of it. Notifications can be in a form of file logs, db logs, system logs, etc. It might not be the appropriate solution but its an alternative. If you have a better idea, why not contribute instead of trolling.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web03 | 2.8.190518.1 | Last Updated 12 Apr 2011
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100