本文整理汇总了C#中Thrift.Transport.TTransport类的典型用法代码示例。如果您正苦于以下问题:C# TTransport类的具体用法?C# TTransport怎么用?C# TTransport使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TTransport类属于Thrift.Transport命名空间,在下文中一共展示了TTransport类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: TFramedTransport
public TFramedTransport(TTransport transport)
{
if (transport == null)
throw new ArgumentNullException("transport");
this.transport = transport;
InitWriteBuffer();
}
开发者ID:ConfusedReality,项目名称:pkg_serialization_thrift,代码行数:7,代码来源:TFramedTransport.cs
示例2: TBufferedTransport
public TBufferedTransport(TTransport transport, int bufSize = 1024)
{
if (transport == null)
throw new ArgumentNullException("transport");
if (bufSize <= 0)
throw new ArgumentException("bufSize", "Buffer size must be a positive number.");
this.transport = transport;
this.bufSize = bufSize;
}
开发者ID:ConfusedReality,项目名称:pkg_serialization_thrift,代码行数:9,代码来源:TBufferedTransport.cs
示例3: GetClient
public static Cassandra.Client GetClient(string keyspace, ref TTransport transport)
{
TTransport frameTransport = new TFramedTransport(new TSocket("localhost", 9160));
TProtocol frameProtocol = new TBinaryProtocol(frameTransport);
var client = new Cassandra.Client(frameProtocol, frameProtocol);
frameTransport.Open();
client.set_keyspace(keyspace);
transport = frameTransport;
return client;
}
开发者ID:died,项目名称:logs.died.tw,代码行数:10,代码来源:ThriftTool.cs
示例4: Connection
/// <summary>
///
/// </summary>
/// <param name="builder"></param>
internal Connection(Server server)
{
Created = DateTime.Now;
Server = server;
TTransport socket = new TSocket(server.Host, server.Port, server.Timeout);
_transport = new TFramedTransport(socket);
_protocol = new TBinaryProtocol(_transport);
_client = new Cassandra.Client(_protocol);
}
开发者ID:rafabunga,项目名称:fluentcassandra,代码行数:15,代码来源:Connection.cs
示例5: ReturnInstance
/// <summary>
/// return an instance.
/// </summary>
/// <param name="instance"></param>
public void ReturnInstance(TTransport instance)
{
if (objectPool.Count >= config.MaxIdle)
DestoryInstance(instance);
else
{
if (config.ValidateOnReturn)
ValidateOnReturn(instance);
PushObject(instance);
activedCount--;
resetEvent.Set();
}
}
开发者ID:bcardi,项目名称:storm-net-adapter,代码行数:18,代码来源:ThriftPool.cs
示例6: Services
public Services(TTransport transport)
{
SessionService = new SessionService.Client(new TMultiplexedProtocol(new TBinaryProtocol(new TFramedTransport(transport)), Utility.Helper.NameOf(() => SessionService)));
UserService = new UserService.Client(new TMultiplexedProtocol(new TBinaryProtocol(new TFramedTransport(transport)), Utility.Helper.NameOf(() => UserService)));
SettingService = new SettingService.Client(new TMultiplexedProtocol(new TBinaryProtocol(new TFramedTransport(transport)), Utility.Helper.NameOf(() => SettingService)));
ChatService = new ChatService.Client(new TMultiplexedProtocol(new TBinaryProtocol(new TFramedTransport(transport)), Utility.Helper.NameOf(() => ChatService)));
ChatUserInfoService = new ChatUserInfoService.Client(new TMultiplexedProtocol(new TBinaryProtocol(new TFramedTransport(transport)), Utility.Helper.NameOf(() => ChatUserInfoService)));
ChatGroupService = new ChatGroupService.Client(new TMultiplexedProtocol(new TBinaryProtocol(new TFramedTransport(transport)), Utility.Helper.NameOf(() => ChatGroupService)));
InboxService = new InboxService.Client(new TMultiplexedProtocol(new TBinaryProtocol(new TFramedTransport(transport)), Utility.Helper.NameOf(() => InboxService)));
InboxRuleService = new InboxRuleService.Client(new TMultiplexedProtocol(new TBinaryProtocol(new TFramedTransport(transport)), Utility.Helper.NameOf(() => InboxRuleService)));
ElifService = new ElifService.Client(new TMultiplexedProtocol(new TBinaryProtocol(new TFramedTransport(transport)), Utility.Helper.NameOf(() => ElifService)));
SearchService = new SearchService.Client(new TMultiplexedProtocol(new TBinaryProtocol(new TFramedTransport(transport)), Utility.Helper.NameOf(() => SearchService)));
NotificationService = new NotificationService.Client(new TMultiplexedProtocol(new TBinaryProtocol(new TFramedTransport(transport)), Utility.Helper.NameOf(() => NotificationService)));
}
开发者ID:tektak-abhisheksth,项目名称:Web-API,代码行数:14,代码来源:Services.cs
示例7: ReturnConnection
public void ReturnConnection(TTransport transport)
{
lock (locker) {
if (idelCount == Conf.TMaxIdel)
DestoryInstance(transport);
else
{
if (Conf.TValidateOnReturn)
ValidateInstance(transport);
PushToPool(transport);
resetEvent.Set();
}
}
}
开发者ID:shentianyi,项目名称:LEONIPack,代码行数:14,代码来源:ConnectionProvider.cs
示例8: Connection
/// <summary>
///
/// </summary>
/// <param name="builder"></param>
internal Connection(Server server, int timeout = 0)
{
Created = DateTime.Now;
Server = server;
Timeout = timeout;
//TcpClient client = new TcpClient(server.Host, server.Port);
//client.NoDelay = true;
//client.SendBufferSize = timeout;
//client.ReceiveTimeout = timeout;
//TTransport socket = new TSocket(client);
TTransport socket = new TSocket(server.Host, server.Port, timeout);
_transport = new TFramedTransport(socket);
_protocol = new TBinaryProtocol(_transport);
_client = new Cassandra.Client(_protocol);
}
开发者ID:KevinT,项目名称:fluentcassandra,代码行数:23,代码来源:Connection.cs
示例9: TDAPIProtocol
/// <summary>
/// TDAPIProtocol Constructor
/// </summary>
public TDAPIProtocol(TTransport trans)
: base(trans)
{
DAPIAliases = new Dictionary<string, string>
{
{ "payload", "p" },
{ "version", "v" },
{ "calls", "c" },
{ "token", "t" },
{ "method", "m" },
{ "argz", "al" }, // note that 'args', represented by 'argz' in struct
{ "name", "n" },
{ "appId", "a" },
{ "snId", "n" },
{ "userId", "u" },
{ "session", "s" },
{ "secret", "as" },
{ "userToken", "t" },
{ "appToken", "t" },
{ "stringToken", "t" }
};
}
开发者ID:praveenkannan,项目名称:testAPIProjectWithThrift,代码行数:25,代码来源:TDAPIProtocol.cs
示例10: TBinaryProtocol
public TBinaryProtocol(TTransport trans, bool strictRead, bool strictWrite)
: base(trans)
{
strictRead_ = strictRead;
strictWrite_ = strictWrite;
}
开发者ID:MingHuaL1,项目名称:Test,代码行数:6,代码来源:TBinaryProtocol.cs
示例11: GetProtocol
public TProtocol GetProtocol(TTransport trans)
{
return new TBinaryProtocol(trans, strictRead_, strictWrite_);
}
开发者ID:MingHuaL1,项目名称:Test,代码行数:4,代码来源:TBinaryProtocol.cs
示例12: GetProtocol
public TProtocol GetProtocol(TTransport trans)
{
return new TJSONProtocol(trans);
}
开发者ID:ConfusedReality,项目名称:pkg_serialization_thrift,代码行数:4,代码来源:TJSONProtocol.cs
示例13: TJSONProtocol
///<summary>
/// TJSONProtocol Constructor
///</summary>
public TJSONProtocol(TTransport trans)
: base(trans)
{
context = new JSONBaseContext(this);
reader = new LookaheadReader(this);
}
开发者ID:ConfusedReality,项目名称:pkg_serialization_thrift,代码行数:9,代码来源:TJSONProtocol.cs
示例14: TProtocol
protected TProtocol(TTransport trans)
{
this.trans = trans;
}
开发者ID:zhangchuhu,项目名称:s2s,代码行数:4,代码来源:TProtocol.cs
示例15: ClientTest
public static void ClientTest(TTransport transport)
{
TBinaryProtocol binaryProtocol = new TBinaryProtocol(transport);
ThriftTest.Client client = new ThriftTest.Client(binaryProtocol);
try
{
if (!transport.IsOpen)
{
transport.Open();
}
}
catch (TTransportException ttx)
{
Console.WriteLine("Connect failed: " + ttx.Message);
return;
}
long start = DateTime.Now.ToFileTime();
Console.Write("testVoid()");
client.testVoid();
Console.WriteLine(" = void");
Console.Write("testString(\"Test\")");
string s = client.testString("Test");
Console.WriteLine(" = \"" + s + "\"");
Console.Write("testByte(1)");
byte i8 = client.testByte((byte)1);
Console.WriteLine(" = " + i8);
Console.Write("testI32(-1)");
int i32 = client.testI32(-1);
Console.WriteLine(" = " + i32);
Console.Write("testI64(-34359738368)");
long i64 = client.testI64(-34359738368);
Console.WriteLine(" = " + i64);
Console.Write("testDouble(5.325098235)");
double dub = client.testDouble(5.325098235);
Console.WriteLine(" = " + dub);
Console.Write("testStruct({\"Zero\", 1, -3, -5})");
Xtruct o = new Xtruct();
o.String_thing = "Zero";
o.Byte_thing = (byte)1;
o.I32_thing = -3;
o.I64_thing = -5;
Xtruct i = client.testStruct(o);
Console.WriteLine(" = {\"" + i.String_thing + "\", " + i.Byte_thing + ", " + i.I32_thing + ", " + i.I64_thing + "}");
Console.Write("testNest({1, {\"Zero\", 1, -3, -5}, 5})");
Xtruct2 o2 = new Xtruct2();
o2.Byte_thing = (byte)1;
o2.Struct_thing = o;
o2.I32_thing = 5;
Xtruct2 i2 = client.testNest(o2);
i = i2.Struct_thing;
Console.WriteLine(" = {" + i2.Byte_thing + ", {\"" + i.String_thing + "\", " + i.Byte_thing + ", " + i.I32_thing + ", " + i.I64_thing + "}, " + i2.I32_thing + "}");
Dictionary<int, int> mapout = new Dictionary<int, int>();
for (int j = 0; j < 5; j++)
{
mapout[j] = j - 10;
}
Console.Write("testMap({");
bool first = true;
foreach (int key in mapout.Keys)
{
if (first)
{
first = false;
}
else
{
Console.Write(", ");
}
Console.Write(key + " => " + mapout[key]);
}
Console.Write("})");
Dictionary<int, int> mapin = client.testMap(mapout);
Console.Write(" = {");
first = true;
foreach (int key in mapin.Keys)
{
if (first)
{
first = false;
}
else
{
Console.Write(", ");
}
Console.Write(key + " => " + mapin[key]);
}
Console.WriteLine("}");
//.........这里部分代码省略.........
开发者ID:vicaya,项目名称:thrift,代码行数:101,代码来源:TestClient.cs
示例16: TFramedTransport
public TFramedTransport(TTransport transport)
{
this.transport = transport;
}
开发者ID:johnny1952,项目名称:mbunit-v3,代码行数:4,代码来源:TFramedTransport.cs
示例17: initClient
private void initClient()
{
transport = new TFramedTransport(new TSocket(SERVER_IP, SERVER_PORT, TIME_OUT));
TProtocol protocol = new TBinaryProtocol(transport);
client = new BigQueueService.Client(protocol);
transport.Open();
}
开发者ID:shshen,项目名称:bigqueue,代码行数:7,代码来源:Program.cs
示例18: Connection
/// <summary>
///
/// </summary>
/// <param name="builder"></param>
internal Connection(Server server, ConnectionBuilder builder)
{
Created = DateTime.Now;
Server = server;
var socket = new TSocket(server.Host, server.Port, server.Timeout * 1000);
switch(builder.ConnectionType)
{
case ConnectionType.Simple:
_transport = socket;
break;
case ConnectionType.Buffered:
_transport = new TBufferedTransport(socket, builder.BufferSize);
break;
case ConnectionType.Framed:
_transport = new TFramedTransport(socket);
break;
}
_protocol = new TBinaryProtocol(_transport);
_client = new Cassandra.Client(_protocol);
}
开发者ID:karlgrz,项目名称:fluentcassandra,代码行数:29,代码来源:Connection.cs
示例19: InitTransportAndClient
/// <summary>
///
/// </summary>
private void InitTransportAndClient()
{
var socket = new TSocket(Server.Host, Server.Port, Server.Timeout * 1000);
switch (ConnectionType)
{
case ConnectionType.Simple:
_transport = socket;
break;
case ConnectionType.Buffered:
_transport = new TBufferedTransport(socket, BufferSize);
break;
case ConnectionType.Framed:
_transport = new TFramedTransport(socket);
break;
default:
goto case ConnectionType.Framed;
}
var protocol = new TBinaryProtocol(_transport);
_client = new Cassandra.Client(protocol);
}
开发者ID:woolfel,项目名称:fluentcassandra,代码行数:28,代码来源:Connection.cs
示例20: GetClient
public static Cassandra.Client GetClient()
{
if (_client == null)
{
if (_transport == null) _transport = new TFramedTransport(new TSocket("localhost", 9160));
var client = new Cassandra.Client(new TBinaryProtocol(_transport));
if (!_transport.IsOpen)
{
try
{
_transport.Open();
}
catch (Exception e)
{
Utility.Logging("transport open fail:" + e.Message);
}
}
if (!_setKeySpace)
{
client.set_keyspace(_keySpace);
_setKeySpace = true;
}
//return client;
_client = client;
}
return _client;
}
开发者ID:died,项目名称:logs.died.tw,代码行数:28,代码来源:ThriftTool.cs
注:本文中的Thrift.Transport.TTransport类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论