Пример #1
0
func (s *SudokuServer) Solve(req *sudoku.SudokuRequest, resp *sudoku.SudokuResponse) error {
	solved := true
	resp.Solved = &solved
	solution := "12345678"
	resp.Checkerboard = &solution
	return nil
}
Пример #2
0
func main() {
	conn, err := net.Dial("tcp", "localhost:9981")
	if err != nil {
		log.Fatal(err)
	}

	client := sudoku.NewSudokuServiceClient(conn)
	req := new(sudoku.SudokuRequest)
	resp := new(sudoku.SudokuResponse)
	puzzle := "001010"
	req.Checkerboard = &puzzle
	err = client.Solve(req, resp)
	if err == nil {
		log.Print(resp.String())
	}

	client.Close()
}