Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get pixelPeek working #51

Open
Lucasthoelke opened this issue Nov 23, 2021 · 3 comments
Open

Can't get pixelPeek working #51

Lucasthoelke opened this issue Nov 23, 2021 · 3 comments

Comments

@Lucasthoelke
Copy link

I can't seem te get pixelPeek working. Am i doing something wrong?

import socket
import sys
import time
import binascii


def sendCommand(s, content):
    print(content)
    content += '\r\n' #important for the parser on the switch side
    s.sendall(content.encode())

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("192.168.178.75", 6000))

sendCommand(s, 'pixelPeek')
res = s.recv(512000)

print(sys.getsizeof(res))

f = open('test.jpeg', 'wb')
f.write(res)
f.close()
@CheukBinLi
Copy link

Have you solved it? I have the same problem.

@CheukBinLi
Copy link

//File corruption
public byte[] pixelPeek() throws IOException, InterruptedException, DecoderException {
String command = "pixelPeek";
getSocketChannel().write(ByteBuffer.wrap(encode(command)));
// ByteBuffer byteBuffer = borrowResource();
ByteBuffer byteBuffer = ByteBuffer.allocate(0x7D000);
int len = getSocketChannel().read(byteBuffer);
if (null == byteBuffer) {
return null;
}
byte[] result = new byte[len];
byteBuffer.get(0, result);
System.out.println(new String(result));
return Hex.decodeHex(new String(result));
// return result;
}
FileOutputStream out = new FileOutputStream(new File("/Users/cheukbinli/Downloads/11111.gif"));
out.write(imageByte1);
out.close();

@CheukBinLi
Copy link

the java code
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants