| /* |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| */ |
| // This file automatically generated by: |
| // Apache Etch 1.1.0-incubating (LOCAL-0) / go 1.1.0-incubating (LOCAL-0) |
| // Wed Nov 17 10:15:00 CET 2010 |
| // This file is automatically created for your convenience and will not be |
| // overwritten once it exists! Please edit this file as necessary to implement |
| // your service logic. |
| package main |
| |
| |
| import "etch" |
| import "org_apache_etch_examples_helloworld" |
| import "fmt" |
| import "bufio" |
| import "os" |
| import "time" |
| |
| func main() { |
| remote := org_apache_etch_examples_helloworld.NewRemoteServer("127.0.0.1:4001") |
| remote.TransportControl(etch.START_AND_WAIT_UP, 4000) |
| |
| //add your calls to the server here |
| |
| returnString := remote.Say_hello(&org_apache_etch_examples_helloworld.User{38,"Testuser"}) |
| fmt.Printf("Server said: " + returnString + "\n") |
| |
| remote.SimpleArrayTest([]int32{1,2,3}) |
| |
| users := make([]*org_apache_etch_examples_helloworld.User, 2) |
| users[0] = &org_apache_etch_examples_helloworld.User{1,"Test1"} |
| users[1] = &org_apache_etch_examples_helloworld.User{2,"Test2"} |
| remote.StructArrayTest(users) |
| |
| |
| start := time.Nanoseconds() |
| for i := 0; i < 100; i++{ |
| remote.Twoway() |
| } |
| end := time.Nanoseconds() |
| fmt.Printf("100 twoway calls took " + fmt.Sprint((end-start)/1e6) + " ms\n") |
| |
| start = time.Nanoseconds() |
| for i := 0; i < 100; i++{ |
| remote.Oneway() |
| } |
| end = time.Nanoseconds() |
| fmt.Printf("100 oneway calls took " + fmt.Sprint((end-start)/1e6) + " ms\n") |
| |
| |
| fmt.Printf("Press Enter to exit\n") |
| reader := bufio.NewReader(os.Stdin) |
| reader.ReadBytes('\n'); |
| remote.TransportControl(etch.STOP_AND_WAIT_DOWN, 4000) |
| } |