Hi,
I want to develop an application in C#, Visual Studio .NET 2008. In which Server Application writes the result of datagridView in Dataset, and other Client application will read that data.
I developed a sample application in which server application writes the string data, and client application read that string data. The code on server side is
using (NamedPipeServerStream pipeServer =
new NamedPipeServerStream("testpipe", PipeDirection.Out))
{
Console.WriteLine("NamedPipeServerStream object created.");
Console.Write("Waiting for client connection...");
pipeServer.WaitForConnection();
Console.WriteLine("Client connected.");
try
{
using (StreamWriter sw = new StreamWriter(pipeServer))
{
sw.AutoFlush = true;
Console.Write("Enter text: ");
sw.WriteLine(Console.ReadLine());
}
}
catch (IOException e)
{
Console.WriteLine("ERROR: {0}", e.Message);
}
The code on client side is
using (NamedPipeClientStream pipeClient =
new NamedPipeClientStream(".", "testpipe", PipeDirection.In))
{
Console.Write("Attempting to connect to pipe...");
pipeClient.Connect();
Console.WriteLine("Connected to pipe.");
Console.WriteLine("There are currently {0} pipe server instances open.",
pipeClient.NumberOfServerInstances);
using (StreamReader sr = new StreamReader(pipeClient))
{
string temp;
while ((temp = sr.ReadLine()) != null)
{
Console.WriteLine("Received from server: {0}", temp);
}
}
}
Console.Write("Press Enter to continue...");
Console.ReadLine();
This works fine, But now I want that Server application write a datagrid view data in datatable/dataset, and client application read that datatable and bind to client's DataGridView.
I used System.IO.Pipes for above task.
Thanks in advance for your help.
Regards
Nauman