mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-22 04:24:19 +00:00
API.java allow partial reads
This commit is contained in:
parent
c432c655f7
commit
00be617ce1
13
API.java
13
API.java
@ -76,6 +76,7 @@ class API
|
|||||||
|
|
||||||
public void process(String cmd, InetAddress ip, int port) throws Exception
|
public void process(String cmd, InetAddress ip, int port) throws Exception
|
||||||
{
|
{
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
char buf[] = new char[MAXRECEIVESIZE];
|
char buf[] = new char[MAXRECEIVESIZE];
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
|
||||||
@ -89,7 +90,15 @@ System.out.println("Attempting to send '"+cmd+"' to "+ip.getHostAddress()+":"+po
|
|||||||
ps.flush();
|
ps.flush();
|
||||||
|
|
||||||
InputStreamReader isr = new InputStreamReader(socket.getInputStream());
|
InputStreamReader isr = new InputStreamReader(socket.getInputStream());
|
||||||
len = isr.read(buf, 0, MAXRECEIVESIZE);
|
while (0x80085 > 0)
|
||||||
|
{
|
||||||
|
len = isr.read(buf, 0, MAXRECEIVESIZE);
|
||||||
|
if (len < 1)
|
||||||
|
break;
|
||||||
|
sb.append(buf, 0, len);
|
||||||
|
if (buf[len-1] == '\0')
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
closeAll();
|
closeAll();
|
||||||
}
|
}
|
||||||
@ -100,7 +109,7 @@ System.out.println("Attempting to send '"+cmd+"' to "+ip.getHostAddress()+":"+po
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
String result = new String(buf, 0, len);
|
String result = sb.toString();
|
||||||
|
|
||||||
System.out.println("Answer='"+result+"'");
|
System.out.println("Answer='"+result+"'");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user