posted 8 years ago
This is continuation of my earlier post http://www.coderanch.com/t/454340/Java-Micro-Edition/Mobile/Bluetooth-Chat-application
I would like to know is there anyway by which a messge can be send to the sender when a message is recieved, i meant identifying sender's connection URL from receieved connection i want a url like this "btspp://localhost:" + SERVICE_ID.toString() + ";name=ChattingService;authorize=false";
I would like to know is there anyway by which a messge can be send to the sender when a message is recieved, i meant identifying sender's connection URL from receieved connection i want a url like this "btspp://localhost:" + SERVICE_ID.toString() + ";name=ChattingService;authorize=false";
A table, a chair, a bowl of fruit and a violin; what else does a man need to be happy?:Einstein
posted 8 years ago
Hello,
I've just started my adventure with jsr-82 so this sollution may not be the best.
StreamConnection is just an interface with a few important methods like openInputStream, openOutputStream etc.
You can try to identify the class implementing this intefrace and find out if it exposes any methods that suit you requirements eg connection endpoints.
Other sollution:
Sending message thread can open input stream(using the same StreamConnection) and read the notfication from message receiver.
Of course message receiver must send the notification by write the output stream(created from the same StreamConnection).
Hope this will help somehow.
Ash
I've just started my adventure with jsr-82 so this sollution may not be the best.
StreamConnection is just an interface with a few important methods like openInputStream, openOutputStream etc.
You can try to identify the class implementing this intefrace and find out if it exposes any methods that suit you requirements eg connection endpoints.
Other sollution:
Sending message thread can open input stream(using the same StreamConnection) and read the notfication from message receiver.
Of course message receiver must send the notification by write the output stream(created from the same StreamConnection).
Hope this will help somehow.
Ash
Abhi Venu
Ranch Hand
Posts: 73
posted 8 years ago
yahooooooooo...................
My problem is solved. I used a method to solve it.
While sending message ,senders conncetion URL was appended to the message to be sent ..that is it can be considered as a header appended to the message to be send .
On the receiving end i stripped the message to get the senders address.
It is done as follows
After registering service in the SDDB ie following code is used to get connection URL to this particular service ,which is then assigned to a string sender
// For storing Senders Address in a variable and appending it while sending messages.
ServiceRecord rb= LocalDevice.getLocalDevice().getRecord(myNotifier);
// gets senders connection URL
sender=rb.getConnectionURL(ServiceRecord.NOAUTHENTICATE_NOENCRYPT,false).toString();
This is appended with message to be sent delimited by a caharacter. ~
argument passed to message sending thread
new SendMessage(sender+"~"+tosend.getString(),currentrecipenturl)
yahooooooooo...................

My problem is solved. I used a method to solve it.
While sending message ,senders conncetion URL was appended to the message to be sent ..that is it can be considered as a header appended to the message to be send .
On the receiving end i stripped the message to get the senders address.
It is done as follows
After registering service in the SDDB ie following code is used to get connection URL to this particular service ,which is then assigned to a string sender
// For storing Senders Address in a variable and appending it while sending messages.
ServiceRecord rb= LocalDevice.getLocalDevice().getRecord(myNotifier);
// gets senders connection URL
sender=rb.getConnectionURL(ServiceRecord.NOAUTHENTICATE_NOENCRYPT,false).toString();
This is appended with message to be sent delimited by a caharacter. ~
argument passed to message sending thread
new SendMessage(sender+"~"+tosend.getString(),currentrecipenturl)
A table, a chair, a bowl of fruit and a violin; what else does a man need to be happy?:Einstein
