You Are Here:

Community: Developer Discussion Boards

#1 Old Problem with SPP and InputStream. Problem 2 how to get around authentication - 2006-09-24, 15:05

Join Date: May 2006
Posts: 23
Jossnaz
Offline
Registered User
Hello

I'm having a problem with a 6230i (haven't tested it with different nokias yet) and a PC-Mobile spp connection using bluecove.
My program works well with motorola and sony ericsson devices.
I build on the spp example (BTGallery) from benhuis site.


I receive a msg from the PC, send back an answer (which works) and then I get:
input stream already opened

Well well, a bit of a surprise that this natel is the only one having that problem. Here the code I used on both, PC and mobile


public void send(String s) {
try {

DataOutputStream out = c.openDataOutputStream();
out.writeUTF(s);
print("writing: '" + s + "'");
out.flush();
Thread.sleep(1000);

out.close();
Thread.sleep(1000);
} catch (Exception e) {
print("send error in spp server "+e.getMessage());
e.printStackTrace();
}
}

public String receive() {
String s = null;
try {

// obtain an input stream to the remote service
DataInputStream in = c.openDataInputStream();

// read in a string from the string
s = in.readUTF();
print("reading: '" + s + "'");
Thread.sleep(1000);
in.close();
Thread.sleep(1000);
} catch (Exception e) {
print("receive error in spp server "+e.getMessage());
e.printStackTrace();
}
return s;
}


there's too a function for image receiving:

private byte[] receiveImage(int numberOfBytes) {

byte[] b = new byte[numberOfBytes];
try {
DataInputStream in = c.openDataInputStream();
in.readFully(b);
in.close();
Thread.sleep(1000);
} catch (Exception e) {
e.printStackTrace();
}

return b;
}

--------------------------------------------


A different question is the authentication
If i use for example

btspp://0013fd9c52aa:25;authenticate=false;encrypt=false

as service URL I still have to authenticate with passkey to enable the bt transfer. Is there a way to get around this or to automate it on the PC side?


thanks


Jossi
Reply With Quote

#2 Old Re: Problem with SPP and InputStream. Problem 2 how to get around authentication - 2006-09-25, 10:18

Join Date: Dec 2005
Posts: 1,159
Location: England,UK
jimgilmour1's Avatar
jimgilmour1
Offline
Forum Nokia Champion
Hi Jossnaz,

The problem with passkey is due to fact that you have not "paired" 6230i with the PC. Then you must set Autoconnect =yes on 6230i.

You cannot bypass this security setting except when you have a commercial application which has been "signed" with a certificate.

Development has to take place with "paired" devices.

See OBEX code at
http://discussion.forum.nokia.com/fo...highlight=obex

Good Luck
Jim
Reply With Quote

#3 Old Re: Problem with SPP and InputStream. Problem 2 how to get around authentication - 2006-09-25, 19:03

Join Date: May 2006
Posts: 23
Jossnaz
Offline
Registered User
First of all, thanks the link is hot! gotta give it a closer look

Quote:
Originally Posted by jimgilmour1
The problem with passkey is due to fact that you have not "paired" 6230i with the PC. Then you must set Autoconnect =yes on 6230i.
I don't have the nokia at my place, have to go to a friend to test it again. That's why I have to ask:
Autoconnect is an option somewhere in the settings of the mobile which the user has to enter, not a piece of code I missed right?
I guess this doesn't solve the PC-Side problem of having to accept pairing each time a new nokia-user tries to use the BT connection to the PC server?

(what I'm programming is a Midlet which downloads questions from a server and sends back some answers. This midlet is meant to be used by the students coming to the courses of our professors... now if a Nokia-student decides to download the questions, but isn't paired with the server, the professor has to hit something like "click this message to pair the BT connection" which in fact, he simply will not do )
Reply With Quote

#4 Old Re: Problem with SPP and InputStream. Problem 2 how to get around authentication - 2006-09-29, 09:37

Join Date: Dec 2005
Posts: 1,159
Location: England,UK
jimgilmour1's Avatar
jimgilmour1
Offline
Forum Nokia Champion
Quote:
Originally Posted by Jossnaz
First of all, thanks the link is hot! gotta give it a closer look



I don't have the nokia at my place, have to go to a friend to test it again. That's why I have to ask:
Autoconnect is an option somewhere in the settings of the mobile which the user has to enter, not a piece of code I missed right?
on 6230i from main screen menu:-
Settings -> scroll down to Connectivity, red dot blue circles,
Select (middle button), Bluetooth,Scroll down to "Paired devices"
Select the already "paired Device",
Select "Options", (left hand button)
Scroll down one item to
"Auto-conn with-
out confirmation"
Press Select, scroll up to yes, press Select,
message pops up says "Confirmation will not be asked"
Click back (right) until at main screen menu.

Good Luck
Jim
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with SPP and InputStream. Problem 2 how to get around authentication Jossnaz Mobile Java Networking & Messaging & Security 0 2006-09-24 14:46
7610 SPP inputstream close after a single read() aluckybird Bluetooth Technology 2 2004-12-28 14:25

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia