From: jm <jmtoro@omepet.es>
To: Bluez-users@lists.sourceforge.net
Subject: [Bluez-users] Problem with RFCOMM socket
Date: Mon, 08 Oct 2007 12:09:17 +0200 [thread overview]
Message-ID: <470A01CD.8090002@omepet.es> (raw)
Hello all,
I am trying to connect BlueZ with JSR-82 with RFCOMM sockets. The BlueZ
server creates a socket server and the JSR-82 MIDlet connects to it.
It all goes well until the server sends some data and closes the socket.
The JSR-82 program launches a "java.io.IOException: Stream closed or
disconnected" when trying to get the number of bytes available from the
stream. The problem can be solved by having the server call sleep(10)
before calling close(clientSocket), giving some time for the client to
fetch the data, but obviously it is a bad solution.
This is the code:
Server, C:
status = write( clientSocket, message, messageSize );
sleep(10); //Comment this for an error
close(clientSocket);
Client, Java:
try
{
while ( inputStream.available() == 0)
{
Thread.sleep(100);
notifyUser("Waiting for data...");
}
}
catch(IOException ex)
{
notifyUser(ex.getMessage());
}
Rest of the code is not relevant in my opinion, but I can post it if
someone needs it to find a solution. However, it is pretty simple and
based in http://people.csail.mit.edu/albert/bluez-intro/x502.html and
http://developers.sun.com/mobility/midp/articles/bluetooth2/
Is there something I am missing about RFCOMM sockets? Is it JSR-82
related? Is it a bug?
Thanks
jm
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Bluez-users mailing list
Bluez-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-users
next reply other threads:[~2007-10-08 10:09 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-08 10:09 jm [this message]
2007-10-08 11:04 ` [Bluez-users] Problem with RFCOMM socket Manuel Naranjo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=470A01CD.8090002@omepet.es \
--to=jmtoro@omepet.es \
--cc=Bluez-users@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox