ASP.NET

推荐列表 站点导航

当前位置:首页 > 脚本编程 > ASP.NET >

以及一些测试程序代码等 2 编译生成.NET库(DLL)和Java库(Jar) 解压thrift-0.9.3.tar.g

来源:网络  作者:网友投稿  发布时间:2021-01-21 11:27
转载请注明出处:jiqbull;钦 39;stechnicalBlogApacheThrift是Facebook实现的一种高效的、支持多种IT之家语言的长途处事挪用的框...

8899);TProtocolprotocol = new TBinaryProtocol(transport);test.Hello.Client client = newtest.Hello.Client(protocol);transport.Open();Console.WriteLine(Client calls client.helloString().....);Console.WriteLine(client.helloString(jiyiqin));client.Dispose();}}} 7 运行 运行java处事端Server.java: thrift server init thrift server start thrift server host on port 8899 get jiyiqin 1 运行C#客户端代码ClientTest.cs Client calls client.helloString()..... Hello jiyiqin 1 请按任意键继承 可以看到Thrift和ICE等跨语言RPC框架开拓步调很是相似,险些沟通, (1) 生成.NET库 打开工程:E:Thrift hrift-0.9.3libcsharpsrcThrift.sln 编译。

即可生成Thrift.dll 我的情况是VS2010以及.NET 4.0 (2) 生成Java库 Java库是通过Ant构建的,需要安装Ant, using System;using System.Collections.Generic;using System.Linq;using System.Text;using Thrift.Transport;using Thrift.Protocol;namespace ThriftTest{class ClientTest{static void Main(string[]args){TTransporttransport = new TSocket(localhost,安装步调这里就不赘述了,转载请注明出处:jiq钦s technical BlogApache Thrift 是 Facebook 实现的一种高效的、支持多种IT之家语言的长途处事挪用的框架,可是和基于Servlet的Hessian这种跨语言RPC框架不同较大,以及一些测试措施代码等 2 编译生成.NET库(DLL)和Java库(Jar) 解压thrift-0.9.3.tar.gz文件。

true);Args args = newArgs(serverTransport);args.processor(process);args.protocolFactory(portFactory);TServer server = newTThreadPoolServer(args);server.serve();} catch (TTransportException e) {e.printStackTrace();}}publicstaticvoidmain(String[] args) {System.out.println(thrift server init);Server server = new Server();System.out.println(thrift server start);server.startServer();System.out.println(thrift server end);} } 6 编写C#客户端代码 新建普通节制台项目, 1 下载Thrift 下载地点: thrift-0.9.3.exe 用于编译Thrift中间文件生成对应语言代码的东西 thrift-0.9.3.tar.gz 包括Thrift各个语言的源码库。

引入Thrift.dll;然后还要将生成的Hello.cs也插手到工程中, 打开呼吁行CD到java库代码地址的路径:E:Thrift hrift-0.9.3libjava(包括build.xml) 然后直接执行ant呼吁即可发明build目次下生成对应的jar文件,雷同的跨语言RPC框架尚有ICE、Hessian、Protocol Buffer、Avro等。

5 编写Java处事端代码 新建普通Java项目, 3 编写thrift中间文件namespace java testnamespace csharp testservice Hello {string helloString(1:string word)}4 生成Java和C#各自的接口文件 Thrift-0.9.3.exe gen java test.thrift Thrift-0.9.3.exe gen csharp test.thrift 可以看到在当前目次下会呈现生成的对应代码,留意包名, ,启动并监听在指定端口: package test;import org.apache.thrift.protocol.TBinaryProtocol; import org.apache.thrift.protocol.TBinaryProtocol.Factory; import org.apache.thrift.server.TServer; import org.apache.thrift.server.TThreadPoolServer; import org.apache.thrift.server.TThreadPoolServer.Args; import org.apache.thrift.transport.TServerSocket; import org.apache.thrift.transport.TTransportException; import test.Hello.Processor; public classServer {@SuppressWarnings({rawtypes,生成的文件也都差不多, (1)首先编写接话柄现类: package test;import org.apache.thrift.TException;import test.Hello.Iface; public classHelloImpl implementsIface{privatestaticintcount= 0;@OverridepublicString helloString(String word)throwsTException {count += 1;System.out.println(get + word + +count);return hello + word + + count;} } (2)编写投止代码, unchecked })public void startServer() {try {System.out.println(thrift server host on port 8899);TServerSocket serverTransport = new TServerSocket(8899);Hello.Processorprocess = newProcessor(newHelloImpl());Factory portFactory = newTBinaryProtocol.Factory(true,将之前ant编译生成的相关的jar文件(libthrift-0.9.3.jar以及E:Thrift hrift-0.9.3libjavauildlib目次下所有jar文件)add tobuild path;然后还要将生成的Hello.java也插手到工程中,。

相关热词:

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供用于网络技术学习参考,学习中请遵循相关法律法规!

本文地址: https://v30.fanwenzhu.com/jiaob/net/13000.shtml

最新文章
 PS:这里需要注意 PS:这里需要注意

时间:2021-01-22

以为这个版本出来 以为这个版本出来

时间:2021-01-22

搜索winform designer 搜索winform designer

时间:2021-01-22

全新的membership框架Asp.ne 全新的membership框架Asp.ne

时间:2021-01-21

i dont know;18if (msg.Contains( i dont know;18if (msg.Contains(

时间:2021-01-21

统筹管理路由规则. 统筹管理路由规则.

时间:2021-01-21

根据switch-case语句来逐一判 根据switch-case语句来逐一判

时间:2021-01-21

EntityFramework 5.0 CodeFirst 教 EntityFramework 5.0 CodeFirst 教

时间:2021-01-21

Copyright © www.juheyunku.com      关于 | 合作 | 声明 | 联系 | 更新 | 地图 | Tags

以及一些测试程序代码等 2 编译生成.NET库(DLL)和Java库(Jar) 解压thrift-0.9.3.tar.g

2021-01-21 编辑:网友投稿

8899);TProtocolprotocol = new TBinaryProtocol(transport);test.Hello.Client client = newtest.Hello.Client(protocol);transport.Open();Console.WriteLine(Client calls client.helloString().....);Console.WriteLine(client.helloString(jiyiqin));client.Dispose();}}} 7 运行 运行java处事端Server.java: thrift server init thrift server start thrift server host on port 8899 get jiyiqin 1 运行C#客户端代码ClientTest.cs Client calls client.helloString()..... Hello jiyiqin 1 请按任意键继承 可以看到Thrift和ICE等跨语言RPC框架开拓步调很是相似,险些沟通, (1) 生成.NET库 打开工程:E:Thrift hrift-0.9.3libcsharpsrcThrift.sln 编译。

即可生成Thrift.dll 我的情况是VS2010以及.NET 4.0 (2) 生成Java库 Java库是通过Ant构建的,需要安装Ant, using System;using System.Collections.Generic;using System.Linq;using System.Text;using Thrift.Transport;using Thrift.Protocol;namespace ThriftTest{class ClientTest{static void Main(string[]args){TTransporttransport = new TSocket(localhost,安装步调这里就不赘述了,转载请注明出处:jiq钦s technical BlogApache Thrift 是 Facebook 实现的一种高效的、支持多种IT之家语言的长途处事挪用的框架,可是和基于Servlet的Hessian这种跨语言RPC框架不同较大,以及一些测试措施代码等 2 编译生成.NET库(DLL)和Java库(Jar) 解压thrift-0.9.3.tar.gz文件。

true);Args args = newArgs(serverTransport);args.processor(process);args.protocolFactory(portFactory);TServer server = newTThreadPoolServer(args);server.serve();} catch (TTransportException e) {e.printStackTrace();}}publicstaticvoidmain(String[] args) {System.out.println(thrift server init);Server server = new Server();System.out.println(thrift server start);server.startServer();System.out.println(thrift server end);} } 6 编写C#客户端代码 新建普通节制台项目, 1 下载Thrift 下载地点: thrift-0.9.3.exe 用于编译Thrift中间文件生成对应语言代码的东西 thrift-0.9.3.tar.gz 包括Thrift各个语言的源码库。

引入Thrift.dll;然后还要将生成的Hello.cs也插手到工程中, 打开呼吁行CD到java库代码地址的路径:E:Thrift hrift-0.9.3libjava(包括build.xml) 然后直接执行ant呼吁即可发明build目次下生成对应的jar文件,雷同的跨语言RPC框架尚有ICE、Hessian、Protocol Buffer、Avro等。

5 编写Java处事端代码 新建普通Java项目, 3 编写thrift中间文件namespace java testnamespace csharp testservice Hello {string helloString(1:string word)}4 生成Java和C#各自的接口文件 Thrift-0.9.3.exe gen java test.thrift Thrift-0.9.3.exe gen csharp test.thrift 可以看到在当前目次下会呈现生成的对应代码,留意包名, ,启动并监听在指定端口: package test;import org.apache.thrift.protocol.TBinaryProtocol; import org.apache.thrift.protocol.TBinaryProtocol.Factory; import org.apache.thrift.server.TServer; import org.apache.thrift.server.TThreadPoolServer; import org.apache.thrift.server.TThreadPoolServer.Args; import org.apache.thrift.transport.TServerSocket; import org.apache.thrift.transport.TTransportException; import test.Hello.Processor; public classServer {@SuppressWarnings({rawtypes,生成的文件也都差不多, (1)首先编写接话柄现类: package test;import org.apache.thrift.TException;import test.Hello.Iface; public classHelloImpl implementsIface{privatestaticintcount= 0;@OverridepublicString helloString(String word)throwsTException {count += 1;System.out.println(get + word + +count);return hello + word + + count;} } (2)编写投止代码, unchecked })public void startServer() {try {System.out.println(thrift server host on port 8899);TServerSocket serverTransport = new TServerSocket(8899);Hello.Processorprocess = newProcessor(newHelloImpl());Factory portFactory = newTBinaryProtocol.Factory(true,将之前ant编译生成的相关的jar文件(libthrift-0.9.3.jar以及E:Thrift hrift-0.9.3libjavauildlib目次下所有jar文件)add tobuild path;然后还要将生成的Hello.java也插手到工程中,。

本站内容来源于网络,如有侵权请与我们联系,我们会及时删除,我们深感抱歉!
注:本站所有信息仅供学习参考!
本文地址为 https://v30.fanwenzhu.com/jiaob/net/13000.shtml

相关文章

风云图片

推荐阅读

返回ASP.NET频道首页