Files
bitminer/Worker/Program.cs
Tommy Parnell 8d738fe39d add worker df
2017-01-11 21:29:21 -05:00

37 lines
1.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Net.Http;
using System.Text;
namespace Worker
{
public class Program
{
static HttpClient httpclient = new HttpClient();
public static void Main(string[] args)
{
MainAsync(args).Wait();
}
public static async Task MainAsync(string[] args)
{
while(true)
{
try
{
var bytes = await httpclient.GetByteArrayAsync("http://gen/8");
var results = await httpclient.PostAsync("http://hashr/hashme", new ByteArrayContent(bytes));
results.EnsureSuccessStatusCode();
var hashResults = await results.Content.ReadAsStringAsync();
var dbResult = await httpclient.GetStringAsync($"http://store/store?dt={DateTime.Now.ToString()}");
await Task.Delay(1000);
}
catch(Exception e)
{
Console.WriteLine(e.Message);
}
}
}
}
}