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
|
901
/// <summary>
/// NamedPipeServer - An implementation of a synchronous, message-based,
/// named-pipe server
///
/// </summary>
public class NamedPipeServer : IDisposable
{
#region Private Members
/// <summary>
/// The pipe handle
/// </summary>
private SafeFileHandle _handle =
new SafeFileHandle(NamedPipeInterop.INVALID_HANDLE_VALUE, true);
/// <summary>
/// The name of the pipe
/// </summary>
private string _pipeName = "";
/// <summary>
/// Default size of message buffer to read
/// </summary>
private int _receiveBufferSize = 1024;
/// <summary>
/// Track if dispose has been called.
/// </summary>
private bool disposed = false;
/// <summary>
/// PIPE_SERVER_BUFFER_SIZE set to 8192 by default
/// </summary>
private const int PIPE_SERVER_BUFFER_SIZE = 8192;
#endregion
#region Construction / Cleanup
/// <summary>
/// CTOR
/// </summary>
/// <param name="pipeBaseName">the base name of the pipe</param>
/// <param name="msgReceivedDelegate">delegate to be notified when
/// a message is received</param>.
public NamedPipeServer(string pipeBaseName)
{
// Assemble the pipe name.
_pipeName = "\\\\.\\PIPE\\" + pipeBaseName;
Trace.WriteLine("NamedPipeServer using pipe name " + _pipeName);
}
/// <summary>
/// Finalizer
/// </summary>
Example 16-5. ...
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