View Single Post
Old 05-07-2020, 02:59 PM   #2
Istarian
New Member
 
Join Date: May 2015
Posts: 3
Istarian is on a distinguished road
Re: Issue collecting input from blowtorch

How do you figure it's an error reading from the socket? Are you seeing that log string or perror call in a way that is unambiguously from the specific connection/socket that the Android (Blowtorch) client is connected to?

Tangentially, if you don't know why there's an absolute adjustment of 10 bytes you might want to figure that out.







Looks like you're actually using pread from unistd.h based on the format... or maybe it's the read POSIX call...

Presumably you're trying to read one byte at a time from the network socket into read_buf until you hit the end of a line and tracking total read bytes insize. Based on the pread documentation it looks like the second parameter should be a fixed number of bytes to read from the offset on... So I'm not sure what 'read_buf + size' is supposed to be; is it really supposed to change with the size and what value do you imagine 'read_buf' to have?

If it's the POSIX read call you mean I think maybe it should be:

because that second parameter is supposed to be a pointer to the buffer... My C is probably rusty though and pointer arithmetic..

Last edited by Istarian : 05-07-2020 at 03:05 PM.
Istarian is offline   Reply With Quote