Here's a solution in C#. Create two console applications, one for the client and one for the server. In the server, put this:
Console.WriteLine("Listening to pipe...");
var server = new NamedPipeServerStream("BrainlyPipe");
server.WaitForConnection();
var reader = new StreamReader(server);
var writer = new StreamWriter(server);
while (true)
{
var line = reader.ReadLine();
if (!server.IsConnected) break;
Console.WriteLine("Received: " + line);
writer.WriteLine(ChangeCase(line));
writer.Flush();
}
To change case, add this function:
public static string ChangeCase( string s)
{
var sb = new StringBuilder();
foreach(char c in s)
sb.Append(char.IsUpper(c) ? char.ToLower(c) : char.ToUpper(c));
return sb.ToString();
}
In the client, put this:
var client = new NamedPipeClientStream("BrainlyPipe");
client.Connect();
var reader = new StreamReader(client);
var writer = new StreamWriter(client);
writer.WriteLine("Brainly question 13806153 demo");
writer.Flush();
Console.WriteLine(reader.ReadLine());
Console.ReadLine();