Skip to Main Content
C# Cookbook, 2nd Edition
book

C# Cookbook, 2nd Edition

by Jay Hilyard, Stephen Teilhet
January 2006
Intermediate to advanced content levelIntermediate to advanced
1184 pages
43h 23m
English
O'Reilly Media, Inc.
Content preview from C# Cookbook, 2nd Edition
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Using Named Pipes to Communicate
|
891
This will produce the following output:
Retrieving file from http://localhost/mysite/index.aspx...
Downloaded http://localhost/mysite/index.aspx to C:\Documents and Settings\[user]\
Local Settings\Temp\tmp17C.tmp
Discussion
WebClient simplifies downloading of files and bytes in files, as these are common
tasks when dealing with the Web. The more traditional stream-based method for
downloading can also be accessed via the
OpenRead method on the WebClient.
See Also
See the “WebClient Class” topic in the MSDN documentation.
16.5 Using Named Pipes to Communicate
Problem
You need a way to use named pipes to communicate with another application across
the network.
Solution
Create a P/Invoke wrapper class for the named-pipe APIs in Kernel32.dll. You can
then create a managed client and managed server class to work with named pipes.
Example 16-3 shows the named-pipe interop wrappers in a class called
NamedPipeInterop.
Example 16-3. NamedPipeInterop class
namespace NamedPipes
{
/// <summary>
/// Imported named-pipe entry points for P/Invoke into native code
/// </summary>
public class NamedPipeInterop
{
// #defines related to named-pipe processing
public const int PIPE_ACCESS_OUTBOUND = 0x00000002;
public const int PIPE_ACCESS_DUPLEX = 0x00000003;
public const int ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C# Cookbook

C# Cookbook

Stephen Teilhet, Jay Hilyard
C# Cookbook

C# Cookbook

Joe Mayo
Head First C#, 4th Edition

Head First C#, 4th Edition

Andrew Stellman, Jennifer Greene

Publisher Resources

ISBN: 0596100639Supplemental ContentCatalog PageErrata