sjamesr / jfreesane

Java API to talk to the SANE scanning daemon
Apache License 2.0
60 stars 25 forks source link

input stream was truncated while reading a word #113

Open jurivrljicak opened 5 months ago

jurivrljicak commented 5 months ago

Hello, from


SaneSession.java  

private void initSane() throws IOException {
    // RPC code
    outputStream.write(SaneRpcCode.SANE_NET_INIT);

    // version number
    outputStream.write(SaneWord.forSaneVersion(1, 0, 3));

    // username
    outputStream.write(System.getProperty("user.name"));
    outputStream.flush();

    **inputStream.readWord();**
    inputStream.readWord();
  }

I am getting 'input stream was truncated while reading a word' in the highlighted line. I don't know why this happens, any idea?

Very often I have to plug/unplug the device for it to establish a communication but this time I can't pass through this error. Got stuck in there.

Using Ubuntu 16.04 LTS and the latest from jfreesane (1.0)

thanks

sjamesr commented 5 months ago

Can you send me the code you're using to call jfreesane?

On Fri, Mar 15, 2024, 7:53 AM jurivrljicak @.***> wrote:

Hello, from

SaneSession.java

private void initSane() throws IOException { // RPC code outputStream.write(SaneRpcCode.SANE_NET_INIT);

// version number
outputStream.write(SaneWord.forSaneVersion(1, 0, 3));

// username
outputStream.write(System.getProperty("user.name"));
outputStream.flush();

**inputStream.readWord();**
inputStream.readWord();

}

I am getting 'input stream was truncated while reading a word' in the highlighted line. I don't know why this happens, any idea?

Very often I have to plug/unplug the device for it to establish a communication but this time I can't pass through this error. Got stuck in there.

Using Ubuntu 16.04 LTS and the latest from jfreesane (1.0)

thanks

— Reply to this email directly, view it on GitHub https://github.com/sjamesr/jfreesane/issues/113, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABDNGA5ORM2O3APVED7KODTYYMDN5AVCNFSM6AAAAABEYEVW6KVHI2DSMVQWIX3LMV43ASLTON2WKOZSGE4DQNZTGI4DQMA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

jurivrljicak commented 5 months ago

It's where I am trying to establish the connection.

            this.inetAddress = InetAddress.getByName(this.host);
            saneSession = SaneSession.withRemoteSane(inetAddress, port);

using Oracle OpenJDK 17.0.2

jurivrljicak commented 5 months ago

could this be a hardware issue? I was tending to think that

sjamesr commented 5 months ago

Do you have a SANE daemon listening on the appropriate port? You can try the regular sane frontend, scanimage, to obtain an image:

scanimage -d net:localhost:

If that works, then something is up with jfreesane.

On Fri, Mar 15, 2024 at 8:59 AM jurivrljicak @.***> wrote:

could this be a hardware issue? I was tending to think that

— Reply to this email directly, view it on GitHub https://github.com/sjamesr/jfreesane/issues/113#issuecomment-1999968425, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABDNGA5DXPESPN4F7SRFQ7LYYMLF7AVCNFSM6AAAAABEYEVW6KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJZHE3DQNBSGU . You are receiving this because you commented.Message ID: @.***>

jurivrljicak commented 5 months ago

hmmm, the port is the default one

yes, scanimage -d kds_i900:i900 > output.pnm does work

sjamesr commented 5 months ago

On Fri, Mar 15, 2024 at 9:20 AM jurivrljicak @.***> wrote:

hmmm, the port is the default one

yes, scanimage -d kds_i900:i900 > output.pnm does work

That's not using the sane daemon though, that command is talking to the scanner directly.

Try something like:

scanimage -d net:localhost:kds_i900:i900

— Reply to this email directly, view it on GitHub https://github.com/sjamesr/jfreesane/issues/113#issuecomment-2000004794, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABDNGA6ZKOX3D5A62L2BC5TYYMNTBAVCNFSM6AAAAABEYEVW6KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBQGAYDINZZGQ . You are receiving this because you commented.Message ID: @.***>

jurivrljicak commented 5 months ago

oh, sorry, then I get

$ scanimage -d net:localhost:kds_i900:i900 scanimage: open of device net:localhost:kds_i900:i900 failed: Error during device I/O

sjamesr commented 5 months ago

You'll have to set up the sane daemon. Something like https://help.ubuntu.com/community/SaneDaemonTutorial

On Fri, Mar 15, 2024 at 9:40 AM jurivrljicak @.***> wrote:

oh, sorry, then I get

$ scanimage -d net:localhost:kds_i900:i900 scanimage: open of device net:localhost:kds_i900:i900 failed: Error during device I/O

— Reply to this email directly, view it on GitHub https://github.com/sjamesr/jfreesane/issues/113#issuecomment-2000043027, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABDNGA5KJ2D3DZMYYOIIP7DYYMQARAVCNFSM6AAAAABEYEVW6KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBQGA2DGMBSG4 . You are receiving this because you commented.Message ID: @.***>

jurivrljicak commented 5 months ago

yes I don't know, I restarted the sane daemon and started working again, looks that process dies at anytime and I am unaware.

Sorry for this and thx again

On Fri, Mar 15, 2024 at 1:54 PM James Ring @.***> wrote:

You'll have to set up the sane daemon. Something like https://help.ubuntu.com/community/SaneDaemonTutorial

On Fri, Mar 15, 2024 at 9:40 AM jurivrljicak @.***> wrote:

oh, sorry, then I get

$ scanimage -d net:localhost:kds_i900:i900 scanimage: open of device net:localhost:kds_i900:i900 failed: Error during device I/O

— Reply to this email directly, view it on GitHub https://github.com/sjamesr/jfreesane/issues/113#issuecomment-2000043027,

or unsubscribe < https://github.com/notifications/unsubscribe-auth/ABDNGA5KJ2D3DZMYYOIIP7DYYMQARAVCNFSM6AAAAABEYEVW6KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBQGA2DGMBSG4>

. You are receiving this because you commented.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/sjamesr/jfreesane/issues/113#issuecomment-2000065710, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEJXK4EOSSEAYWR645RN4PDYYMRSXAVCNFSM6AAAAABEYEVW6KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBQGA3DKNZRGA . You are receiving this because you authored the thread.Message ID: @.***>