Re: Any small sample Class Service code for Java
On 9月20日, 上午3时34分, "Kenton Varda" <[EMAIL PROTECTED]> wrote: > On Fri, Sep 19, 2008 at 9:50 AM, Mars <[EMAIL PROTECTED]> wrote: > > > just want to find some sample code for Class Service: > > >http://code.google.com/apis/protocolbuffers/docs/reference/python/goo... > > That's the Python version. Shouldn't you be looking at the Java version? > thank you for your quick response. yes, the page i pasted is the python version, i need a Java version. > http://code.google.com/apis/protocolbuffers/docs/reference/java/com/g... > > for example: > > > given .proto .java files below, > > how to use simply use them in some basic Java network program, such as > > ServerSocket or DatagramSocket? > > Maybe look at some of the RPC implementations people are working on: > > http://code.google.com/p/protobuf/wiki/RPCImplementations > I checked this page before. http://protorpc.likbilen.com/ only binary, no source code. btw, it's more complex than what I want, :) I just want a very basic code to use java server and protobuf rpc together. https://launchpad.net/txprotobuf/ python code. http://code.google.com/p/protobuf-rpc/ not available > > > > = > > # .proto > > message Req1 { > > required int32 id = 1; > > } > > > message Res1 { > > required string name = 1; > > } > > > service Serv1 { > > rpc Func1(Req1) returns (Res1) { > >option name = "name1"; > > } > > } > > > == > > // .java > > public class MyServ implements Serv1 { > > > public EmptyMessage Func1(RPC rpc, Req1 req) throws RpcException { > >//... > > } > > } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to protobuf@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~--~~~~--~~--~--~---
Re: Any small sample Class Service code for Java
On Fri, Sep 19, 2008 at 9:50 AM, Mars <[EMAIL PROTECTED]> wrote: > > just want to find some sample code for Class Service: > > http://code.google.com/apis/protocolbuffers/docs/reference/python/google.protobuf.service.Service-class.html That's the Python version. Shouldn't you be looking at the Java version? http://code.google.com/apis/protocolbuffers/docs/reference/java/com/google/protobuf/Service.html for example: > given .proto .java files below, > how to use simply use them in some basic Java network program, such as > ServerSocket or DatagramSocket? Maybe look at some of the RPC implementations people are working on: http://code.google.com/p/protobuf/wiki/RPCImplementations > > > = > # .proto > message Req1 { > required int32 id = 1; > } > > message Res1 { > required string name = 1; > } > > service Serv1 { > rpc Func1(Req1) returns (Res1) { >option name = "name1"; > } > } > > == > // .java > public class MyServ implements Serv1 { > > public EmptyMessage Func1(RPC rpc, Req1 req) throws RpcException { >//... > } > } > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to protobuf@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~--~~~~--~~--~--~---
Any small sample Class Service code for Java
just want to find some sample code for Class Service: http://code.google.com/apis/protocolbuffers/docs/reference/python/google.protobuf.service.Service-class.html for example: given .proto .java files below, how to use simply use them in some basic Java network program, such as ServerSocket or DatagramSocket? = # .proto message Req1 { required int32 id = 1; } message Res1 { required string name = 1; } service Serv1 { rpc Func1(Req1) returns (Res1) { option name = "name1"; } } == // .java public class MyServ implements Serv1 { public EmptyMessage Func1(RPC rpc, Req1 req) throws RpcException { //... } } --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to protobuf@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~--~~~~--~~--~--~---