Click here to Skip to main content
15,896,727 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

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
 
Share this answer
 
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);
}
 
Share this answer
 
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900