P2P communication , chat App (android) - java

i am using this tutorial as guide. i am creating an android app which is basically chat application. this uses socket programming to communicate .
i want to connect directly to device and deliver the message. the message does not go to server. server only tell me the address of the device thats it.
i followed the tutorial i mentioned above and this only works for the case where client and server are within same wifi/network. i want to connect to server from client irrespective of their network connection place. how do i do it from any network to any network.
i think i need to use port forwarding , but this is not practical . so we better use a server for keeping track of all the ip changes. and deliver the messages directly from the source to client. so how do i do it. please suggest any resources.
update
as of now what i studied is i have to use innetaddress to communicate if i am inside an wifi router.
thank you

Related

Creating local server on an Android device

I have an idea for an application where one device is a server, and other devices connect to this server.
The clients would send data and call HTTP requests (or whatever is equal to them in this case), and the server would receive the request and act on it.
I understand there is such a thing as Sockets, but does this fulfill my requirement? Will I be able to call requests on the other device?
Example usage: The client clicks the + button, and the server increments the value.
Have a look at P2P, it uses Wifi Direct, so one device can be setup as a host server and the other devices can register to that as clients.
Check out the official documentation.

sending message through IP address in eclipse android program using sockets

I want to make an app which could send message to a particular mobile phone which has the same application by using IP address of the receiver. Assume that we know the IP address of the receiver, there is no need to first find the IP address of the receiver. I just want to send message through IP address which i know. and one more thing i want to directly send message to the receiver, there must be no 3rd party involved. i think we can use socket programming in this like we use in JAVA but i do not know how in android?? can anyone suggest me how to do it?? or can someone suggest me some website where i can get coding part of this.
I use Smack API. You can read here for more information on how to use this API.
You can connect to device using socket and once connected you can send a message to your service /application which is installed on device. This will in turn modify the DB of messaging. Once that gets modified, the message will displayed.

Client Server Apps+java

I have a java requirment contains both client and server side program.
Server side
Server program frequently check the data base and checks if a new order came, if order came it check the order and send it to the corresponding client machine using IP address and port.The client machines are out side the LAV and has static IP address.
Client side
Client program listen a its on port , when an order came, read it and process.
For implementing these app, which java package is best,java socket communication or any other.Anybody know please suggest one.
Help is highly appreciated,
Thanks,
vks.
Don't go for low level programming like Sockets etc. Use RMI. Your program will have following two entities
Server side :
An RMI Client for calling client machine to send update after checking the database
Client side :
An RMI server application listening for Server update requests and do processing.
If you are new to RMI check out this tutorial . You can search for better tutorials if don't find these good enough :).
I remember I had to do something similar in the university and I used JMS (Java Messaging Service), documented here:
http://www.oracle.com/technetwork/java/jms/index.html
The Server will create the messages from the DB by checking it periodically and will send messages to the clients which will process the info.

Server on windows, clients on android

I am now trying to do a project which is, there will be a server on windows pc and there are some clients on android devices.The point is the server one should control the android devices.For example it choose a image or video, send them to the clients and the clients play or show them.Remember the clients should be control by the server.
So could anyone tell me a proper way to do that, which protocol should i use, how do i send the files to the clients and how do the clients react? I am thinking of using java for the server and of course the client will use android application.
Thank you.
You might find Cloud to Device Messaging (c2dm) useful: http://code.google.com/android/c2dm/index.html
In essence, c2dm allows a remote server to send an Intent to an Android app. The device-side app can then respond to that intent to take the requested action. Chrome2phone works this way to open web links on a target device. http://code.google.com/p/chrometophone/

GPRS Application using Java

We developed application written in Java/J2EE using which send and receives SMS from service provider and presently we are facing problem that there is some delay in messages and it cost's more for us.
by considering above situation we planned to move to GPRS technology (which is more cheaper and considerably fast).
So please suggest a course of action I can start with and post any sample application for GPRS-enabled system in Java.
With GPRS you would need a client application running in the mobile device. This means a lot of headaches for developing, deploying and supporting. Also, although it would be trivial for the clients to send messages, receiving won't be so straightforward. You would need to implement some kind of a "push" service. One of the problems would be that the client application should be always running.
In general, it isn't easy to replace SMS messages with GPRS communication. You may need to considerably change the architecture of your system.
To make a GPRS application using java you have to need GPRS Modem. First of all you have to make one container which handle request and replay of GPRS modem and your API. API contain private ip and port number wich send the request to container and container then send request to modelm and modem will give response to container and it send back to API.
By using methd Socket("IP Address", port number) you can connect with container and modem .
You have to need a public Ip Address andPort Number, it create virtual pipline between modem and container like as a telnet.
Using GPRS instead of GSM to send an SMS will not cause the SMS to be delivered any faster. You're barking up the wrong tree.

Categories

Resources