Click here to Skip to main content
15,902,875 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello,
I need to develop app that transfer data between two different devices.
For example I need to build chat application that send message between two devices that sit in different geographic area.
(via internet connection !)
Device A know the IP of Device B and via versa.
I know that the IP I received in my devices are under the ISP.
I have some question :
1. There is any solution for that issue without connection server in the middle, sending messages/data between different devices (without any third part component).
2.If the answer for question 1 is NO! (or it's very difficult for implementation) . May you can suggest a way to implement with server in the middle (how to keep the channel open ?) .
The server need to keep the sockets of the two devices open all the time?? , or may to connect made by demand (how application like whatsapp work?).

Thanks.
MAK

What I have tried:

searching in google and code project
Posted
Updated 11-Oct-16 9:25am
Comments
[no name] 5-Oct-16 10:50am    
You searched in google for "android peer to peer chat" and found nothing? I got almost 500K results....
Member 11326763 5-Oct-16 11:37am    
Please , share with us working solution , that not use commercial third party component.
And working via the internet (not via wifi)
[no name] 5-Oct-16 12:08pm    
Why? Why should anyone just hand their hard work over to you? Why can't you do your own research and write your own code?
Member 11326763 7-Oct-16 6:35am    
First of all,I want to clear the issue, I am not asking you or any one other to make the job for me.
My question was Conceptual only!!.
You say you found the answer in Google so I ask to share it with me.
The result from your search key in Google, I already see and test, and the result are not satisfying.
I ask this question for know IF I MISS SOMETHING !!
Like you properly look in the result.
P.S:If You don't have something nice to say don't say nothing at all

[no name] 7-Oct-16 9:01am    
First of all, you *did* ask us to do your work for you, "share with us working solution".
Second of all, we are NOT your research assistants. Doing your research is YOUR job not anyone else's.
Thirdly, you didn't ask any question. You asked us to do your job for you and that is not going to happen.
Fourth, your inability to ask a question or do your own job doesn't mean that I was mean to you. I was perfectly nice to you. I simply asked you why you think we should do your job for you. A question you apparently cannot answer.

No one here is going to do the work for you, this is what you are indicating in the comments. As NotPoliticallyCorrect said, a simple google search will solve your problem.

https://www.google.com/search?q=android+peer+to+peer+chat&ie=utf-8&oe=utf-8[^]

Also, you say you want it to work over the internet and not wifi. But these are android devices...am I missing something?

Quote:
1. There is any solution for that issue without connection server in the middle, sending messages/data between different devices (without any third part component).


If you aren't willing to entertain 3rd party components, be prepared to roll up your sleeves and do some work. Because if you don't want to pay for something then you are probably going to have to build it yourself.

Quote:

2.If the answer for question 1 is NO! (or it's very difficult for implementation) . May you can suggest a way to implement with server in the middle (how to keep the channel open ?) .
The server need to keep the sockets of the two devices open all the time?? , or may to connect made by demand (how application like whatsapp work?).


Based on this second question, you really need to do some research on how web services work. What you are probably going to end up doing is exposing a web service that can respond to the requests of your devices as necessary. Now the web service is something you are going to have to build.

I suggest you google, how to build a web service in java, to complete this portion.

Then your devices will make calls to the web services based on what your requirements are/what you are trying to accomplish.

You need to remember, we are not a service that does the work for you. If you want someone to hand over their work you need to go to freelancers.com or something like that.

Now, should you attempt this project and get stuck along the way, feel free to come back with a clear explanation of your issue, some relevant code samples and a better attitude towards getting help and I am sure someone will be happy to provide you assistance. You need to keep in mind that we don't have access to your computer, your code, nor do we read minds or know anything about your project.
 
Share this answer
 
1. using FCM former GCM: https://developers.google.com/cloud-messaging/concept-options#notifications_and_data_messages[^] for limitations e.g. 4K-Payload see the link.

2. Search for WebRTC Client-/Server-Implementations. In short it is impossible to connect two devices without a server involved. Search for "udp hole punching", "stun server", etc in goolge. Thats how WebRTC essentially works. Google has some servers for that purpose and they may be free of charge.

3. Use a pub/sub, xmpp, websocket, messagebroker-, message-queue- or an all-in-one-provider, rent their infrastructure and use their sdks/libs.

4. Setup #3 by yourself. Search google for implementations in the language of your choice.

The first solution might be the cheapest and simplest, the second is horrible, #3 is the most painless and straigt forward but IMHO no LOB solution in terms of compliance and reliability, except of the major players. #4 is hard work and even harder to operate and maintain in terms of monitoring, updating, scaling, etc.

have fun
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900