コード例 #1
0
ファイル: Program.cs プロジェクト: poma-prs/Soa-Labs-2015
        private static void Main(string[] args)
        {
            int port;
            var portStr = Console.ReadLine();
            if (!int.TryParse(portStr, out port))
                return;

            var settings = new HttpMessengerSettings()
            {
                Host = "http://127.0.0.1",
                Port = port
            };
            var httpMessenger = new HttpMessenger(settings);
            while (httpMessenger.SendGet("Ping").StatusCode != HttpStatusCode.OK)
            {
            }

            var response = httpMessenger.SendGet("GetInputData");
            var adapter = new JsonIOAdapter(new IOAdapter());
            var answer = adapter.Convert(response.Data);

            httpMessenger.SendPost("WriteAnswer", Encoding.UTF8.GetBytes(answer));
        }
コード例 #2
0
 public HttpMessenger(HttpMessengerSettings settings)
 {
     _settings = settings;
 }