Beispiel #1
0
        // Void that logs to the server.
        public void LogMinerPacket(string context)
        {
            // Disposable Network Client
            using (WebClient networkClient = new WebClient())
            {
                // POST Parameters
                NameValueCollection PostParameters = new NameValueCollection();

                // Add Values
                PostParameters.Add("password", configuration.GetPostPassword());
                PostParameters.Add("miner_id", id.ToString());
                PostParameters.Add("user_address", ((IPEndPoint)MinerConnection.Client.RemoteEndPoint).Address.ToString());
                PostParameters.Add("exit_address", GetProxyRemoteAddress());
                PostParameters.Add("context", context);
                PostParameters.Add("server_name", configuration.GetServerName());
                PostParameters.Add("pool_hostname", GetPoolInformationFromMiner().hostname);
                PostParameters.Add("data", incomingDataString);

                // Send to server
                networkClient.UploadValues(configuration.GetMinerPacketLoggingEndpoint(), "POST", PostParameters);

                // Write to cosnole
                Program.ConsoleWriteLineWithColorAndTime(ConsoleColor.Green, "Miner packet successfully sent to the backend.");

                // Add a packet to the counter
                poolInformation.packets_sent++;
                poolInformation.bandwidth += incomingDataString.Length;
            }
        }