Closed exbit closed 6 years ago
@exbit Show the start line of the Excavator For your data, it should look like this: excavator.exe -p 38100 -i 0.0.0.0
Make sure that the excavator listens for requests on the interface and port you need: [12:37:14][0x00013978][info] Log started [12:37:14][0x00013978][info] core | Found CUDA device: GeForce GTX 1080 [12:37:15][0x00013978][info] api | Listening on 0.0.0.0:38100 [12:37:15][0x00013978][info] http | Listening on 0.0.0.0:38080
=========================== www.nicehash.com ========================= Excavator v1.5.2a_nvidia GPU Miner for NiceHash. Copyright (C) 2018 NiceHash. All rights reserved. =========================== www.nicehash.com =========================
Build time: 2018-04-16 08:41:16 Build number: 5070 Provided startup commandline: excavator.exe -c command.json -d 2 -f 0 -fn log.txt -p 38100 -i 0.0.0.0 -wp 38080 -wi 0.0.0.0 -wa
[15:26:43][0x00000b64][info] Log started [15:26:45][0x00000b64][info] core | Found CUDA device: GeForce GTX 1080 Ti [15:26:47][0x00000b64][info] core | Found CUDA device: GeForce GTX 1080 Ti [15:26:47][0x00000b64][info] core | Found CUDA device: GeForce GTX 1080 Ti [15:26:47][0x00000b64][info] core | Found CUDA device: GeForce GTX 1080 Ti [15:26:47][0x00000b64][info] core | Found CUDA device: GeForce GTX 1080 Ti [15:26:47][0x00000b64][info] core | Found CUDA device: GeForce GTX 1080 Ti [15:26:47][0x00000b64][info] core | Found CUDA device: GeForce GTX 1080 Ti [15:26:47][0x00000b64][info] api | Listening on 0.0.0.0:38100 [15:26:47][0x00000b64][info] http | Listening on 0.0.0.0:38080 [15:26:47][0x00000b64][info] core | Initialized!
Here is the debug client connection: 10.10.10.2
[15:29:15][0x00001ed4][debug] api | Accepted 10.10.10.2:12870 [15:29:15][0x00001a60][debug] api | Connection lost 10.10.10.2:12870
Via Telnet API works: >telnet 10.10.10.12 38100
As I understand the connection you have and everything works as it should :
[15:29:15][0x00001ed4][debug] api | Accepted 10.10.10.2:12870 [15:29:15][0x00001a60][debug] api | Connection lost 10.10.10.2:12870
Try add the '\n' terminator to the end of the $message.
For example:
$message = "{\"id\":1,\"method\":\"message\",\"params\":[\"Test!\"]}\n";
or more clearly:
$message = '{"id":1,"method":"message","params":["Test!"]}';
$message.= "\n";
I checked you code with my change - everything works fine:
<?php
@ini_set("display_errors", "1"); error_reporting(E_ALL);
//@ini_set("display_errors", "0"); error_reporting(0);
$host = '10.0.0.7';
$port = 33333;
$message = '{"id":1,"method":"message","params":["Test!"]}';
$message.= "\n";
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
socket_connect($socket, $host, $port) or onSocketFailure("Failed to connect", $socket);
socket_write($socket, $message, strlen($message));
$response = socket_read($socket, 1024); //timeout error
socket_close($socket);
var_dump($response);
result:
string(22) "{"id":1,"error":null}"
Thanks, I realized my mistake, now it works. Tell me it is possible through API to send in a single request several commands?
@exbit As far as I know, no.
There is always a timeout error when reading a response. The same thing works using telnet $host = '10.10.10.12'; $port = 38100; $message = '{"id":1,"method":"message","params":["Test!"]}';
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); socket_connect($socket, $host, $port) or onSocketFailure("Failed to connect", $socket); socket_write($socket, $message, strlen($message)); $response = socket_read($socket, 1024); //timeout error socket_close($socket);
var_dump($response);