Q
Problem solve Get help with specific problems with your technologies, process and projects.

How do I write a Web service that can send an event with arguments to clients?

I am writing a Web service to which many clients will connect. At some point, from the Web services, I want to send an event with some arguments to the clients. Is this possible? Can I do this through delegates? If so, can you help me with a sample code in VB/C#?
Web services are like ASP.NET pages, and ultimately reflect the underlying protocol (HTTP) disconnected nature: once the request/response cycle has finished, any connection between both vanishes.

You could provide some sort of MarshalByRef object pointer to the Web service, and let it serialize it and persist it for later reconnection, as explained in this article, but the client must have a port open for receiving this callback. What's more, if two application domains are trying to pass a remoting reference to the Web service with the same port, there will be a runtime error, as only one of them will be able to listen on that port.

But if you get to this point, why use Web services in the first place? Why don't you go directly for full remoting?

This was last published in April 2003

Dig Deeper on C# programming language

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchCloudComputing

SearchSoftwareQuality

TheServerSide.com

SearchCloudApplications

Close