File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java Micro Edition and the fly likes Connecting two mobiles through socket connection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Connecting two mobiles through socket connection" Watch "Connecting two mobiles through socket connection" New topic

Connecting two mobiles through socket connection

Harish Tiruvile
Ranch Hand

Joined: Dec 01, 2005
Posts: 99
Hi all,

Is it possible to connect two mobile\cellphones using socket connection(similar two one that we can do between two PC)

To establish socket connection ,I need IP address and a port .

i should assign IP address for each mobile ...Based on IP address i can identify the Mobile ..

1)Can i establish socket connection between
(a)Mobile - Mobile
(b)PC - Mobile
(c)Mobile - PC (i know this is possible,but i have doubt about a & b)

Suppose if we can establish socket connection between PC and Mobile can any one assist me in setting IP address and port .

Giving up is the easiest thing in the world to do..but holding it together when everything seems like falling apart is true strength!!
with regards, Harish.T
Ransika deSilva
Ranch Hand

Joined: Feb 18, 2003
Posts: 524
It is possible create a socket connection using the SocketConnection class in the GCF. But if you want to connect a PC to a mobile through socket connection, it will be a problem, cause it is a server push. You can use the PushRegistry to push data from the server to the phone. According to my knowledge it is not possible to configure a IP address to a phone, you will get one when you connect through GPRS. Hope this information helps you. Regards.

SCJP 1.4, SCMAD 1.0<br />SCWCD, SCBCD (in progress)
Eduardo Marques
Ranch Hand

Joined: Feb 19, 2005
Posts: 231
As long as two devices (PC or mobile) have IP addresses, they can be connected through SocketConnection or ServerSocketConnection on the J2ME side; whatever socket API you use on the PC.

ServerSocketConnection and Push Registry can be combined so that a MIDlet is started in response to an incoming socket connection on a specified port.

There is no standard way for assigning an IP to a mobile, it should be the one you get through GPRS. It is normally best to have the mobile contact a known server (ie the one you want) first to acknowledge its presente.

Eduardo Marques
Get ready for your SCMAD certification at - See what all the buzz is about ...
I agree. Here's the link:
subject: Connecting two mobiles through socket connection
It's not a secret anymore!