O'Reilly logo

Microsoft® Visual Basic® .NET Programmer's Cookbook by Matthew MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Use a One-Way Method

Problem

You want a method in a remote object to perform a long task, and you don’t want to force the client to wait while the method code executes.

Solution

Create a one-way method by applying the OneWay attribute from the System.Runtime.Remoting.Messaging namespace.

Discussion

With one-way methods, the client sends a request message, and the remote object responds immediately to indicate it has begun processing. This has several consequences:

  • The client doesn’t need to wait while the method code executes.

  • The method can’t return any information to the client, either through a return value or ByRef parameter.

  • If the method throws an unhandled exception, it won’t be propagated back to the client.

To create a one-way method, you need ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required