using Thrift.Protocol; using System.IO; using System.Threading.Tasks; // create a TProtocol from a MemoryStream var memoryStream = new MemoryStream(); var protocol = new TBinaryProtocol(new TStreamTransport(memoryStream)); // write a boolean value to the protocol protocol.WriteBool(true); // read the boolean value asynchronously bool value = await protocol.ReadBoolAsync(); // output the value Console.WriteLine(value); // outputs "True"
using Thrift.Protocol; using Thrift.Transport; using System.Net.Sockets; using System.Threading.Tasks; // create a TProtocol from a TCP socket var tcpClient = new TcpClient(); await tcpClient.ConnectAsync("localhost", 9090); // assume server is listening on port 9090 var transport = new TSocketTransport(tcpClient); var protocol = new TBinaryProtocol(transport); // read a boolean value from the protocol asynchronously bool value = await protocol.ReadBoolAsync(); // output the value Console.WriteLine(value);
Install-Package Thrift