Hi,
I want to create a Socket Connection over the Internet:
On my Android Device I´ve opened a Socket Server:
Code:
ServerSocket ss = new ServerSocket(4711);
Log.i("Tcp Example", "Start Socket ");
while(!end){
//Server is waiting for client here, if needed
Log.i("Tcp Example", "Wait for client: ");
Socket s = ss.accept();
Log.i("Tcp Example", "Client acceptet");
BufferedReader input = new BufferedReader(new InputStreamReader(s.getInputStream()));
PrintWriter output = new PrintWriter(s.getOutputStream(),true); //Autoflush
String st = input.readLine();
Log.i("Tcp Example", "From client: "+st);
...
...
And for Tests I´ve created a Socket Client in Java:
Code:
Main() throws IOException{
System.out.println("... verbinde!");
client = new Socket (serverName, port);
System.out.println("... success!");
out = new BufferedWriter(new OutputStreamWriter(client.getOutputStream()));
System.out.println("... out!");
in = new BufferedReader(new InputStreamReader(client.getInputStream()));
System.out.println("... int!");
sendData("TTTESSSTTT");
}
// Sendet Daten an den Server
public void sendData(String outgoing) throws IOException{
out.write(outgoing);
out.newLine();
out.flush();
}
This works finde when I´m in my local Network @ Home, but I want to connected to the Server over the Internet (with a Web Interface - PHP), so I get my Mobile IP Adress von here http://www.whatsmyip.org/, start the Server and want to connect with the Cliebt to this IPAdress, but nothing happens.
Is it even possible or what am I doing wrong?
Thanks!
IceTi said:
Hi,
I want to create a Socket Connection over the Internet:
On my Android Device I´ve opened a Socket Server:
Code:
ServerSocket ss = new ServerSocket(4711);
Log.i("Tcp Example", "Start Socket ");
while(!end){
//Server is waiting for client here, if needed
Log.i("Tcp Example", "Wait for client: ");
Socket s = ss.accept();
Log.i("Tcp Example", "Client acceptet");
BufferedReader input = new BufferedReader(new InputStreamReader(s.getInputStream()));
PrintWriter output = new PrintWriter(s.getOutputStream(),true); //Autoflush
String st = input.readLine();
Log.i("Tcp Example", "From client: "+st);
...
...
And for Tests I´ve created a Socket Client in Java:
Code:
Main() throws IOException{
System.out.println("... verbinde!");
client = new Socket (serverName, port);
System.out.println("... success!");
out = new BufferedWriter(new OutputStreamWriter(client.getOutputStream()));
System.out.println("... out!");
in = new BufferedReader(new InputStreamReader(client.getInputStream()));
System.out.println("... int!");
sendData("TTTESSSTTT");
}
// Sendet Daten an den Server
public void sendData(String outgoing) throws IOException{
out.write(outgoing);
out.newLine();
out.flush();
}
This works finde when I´m in my local Network @ Home, but I want to connected to the Server over the Internet (with a Web Interface - PHP), so I get my Mobile IP Adress von here http://www.whatsmyip.org/, start the Server and want to connect with the Cliebt to this IPAdress, but nothing happens.
Is it even possible or what am I doing wrong?
Thanks!
Click to expand...
Click to collapse
Ain't gonna happen. Your android gets a private IP (normally 10.x.x.x) which by internet standards cannot be seen outside the local network. You can get around this on home computers by setting up port forwarding and such on your router (which you could do if your phone is on wifi and you have access to the router--i.e. your home access point), but I doubt that the phone company is going to let you forward ports on the router at their local switch.
Gene Poole said:
Ain't gonna happen. Your android gets a private IP (normally 10.x.x.x) which by internet standards cannot be seen outside the local network. You can get around this on home computers by setting up port forwarding and such on your router (which you could do if your phone is on wifi and you have access to the router--i.e. your home access point), but I doubt that the phone company is going to let you forward ports on the router at their local switch.
Click to expand...
Click to collapse
Yes I gete a private (internal) IP but I also get an external IP.
This external IP is indeed addressed by for ex. a webiste or something like this. The website also send Data direct over the internet to my phone... so why is it not possible to send data from MY website to direct my appilication?
Because that IP you see in "whatsmyip.com" is shared by any number of devices. How would the router know that you're running a server on a particular port and to redirect any traffic to that port to your device and your device only?
This is basic TCP/IP, and beyond the scope of this forum. Look it up if you want more info.
Hmmm, I think I´m confussed now
How do other Apps a Client/Server Communication for Example "Whats App".
Well, I want to create a Website which allows me to send Data to my Phone. The Server is started on the Phone and the Website connects to it or the other way?!
Because that IP you see in "whatsmyip.com" is shared by any number of devices. How would the router know that you're running a server on a particular port and to redirect any traffic to that port to your device and your device only?
Click to expand...
Click to collapse
I think this is not right.. for the moment this IP is just for MY Device...
IceTi said:
Hmmm, I think I´m confussed now
How do other Apps a Client/Server Communication for Example "Whats App".
Well, I want to create a Website which allows me to send Data to my Phone. The Server is started on the Phone and the Website connects to it or the other way?!
I think this is not right.. for the moment this IP is just for MY Device...
Click to expand...
Click to collapse
Not to belabor this too much more, but as a for instance, do you have a broadband connection at home? How many computers are connected to it? Run whatsmyip.com on all of them and tell me what you get. Try running a server on one of those computers and connecting from some arbitrary client on the internet. What happens? It's more or less the same with your phone. The details differ depending on the carrier, etc. but essentially all the phones on a given node are going to have a common router at the switch and that's the IP you see at whatsmyip.com. The router uses NAT to allow clients on the private network to connect to servers on the internet, but NAT doesn't work the other way (without explicitly enabling certain ports to certain machines in the routing tables of the router itself). It's possible that you are the only phone on the network node at some given time, but not the norm and even if you are the only one for some reason, the node router isn't going to treat your phone any differently.
Related
I have been trying to establish a VPN connection with my xda over gprs to my office computer (PPTP) but I am not sure I have made the appropriate settings. There is no place to type in my username and password (except for the gprs connection).
Can anyone guide me on how to ensure a proper connection?
Also, I am not sure what the VPN connection will mean in terms of pocket pc functionality. Will it mean that I can access my office e-mail which would otherwise require a direct dial in? Will I be able to synchronize with my office outlook?
I would greatly appreciate your help. Thanks, apap
VPN
hi,
suggest ringing 0845 6006886 (O2 GPRS Helpline).
They have a PDF Doc that may help. They will e-mail it to you.
Doc Title VPN_Access_over_mobile_web.
Good luck
Ric.
Thanks for your help Ric.
I have followed the settings as discussed in the pdf file but I have not had any success. I will call the helpline.
private networks
Please note that if you are using O2 and your office have a private network range in the 10.0.0.0 range, you will have problems due to the subnet mask used, and the fact that O2 use NAT.
I have written a utility which monitors the routing table, and overcomes this problem by narrowing the net mask. Anyone who is interested, contact me for this software: [email protected]
I tried to 'give' this software to O2, but they didn't seem to care. They didn't really seem to understand the problem.
Re: private networks
martinlong1978 said:
[...]
I have written a utility which monitors the routing table, and overcomes this problem by narrowing the net mask. Anyone who is interested, contact me for this software: [email protected]
I tried to 'give' this software to O2, but they didn't seem to care. They didn't really seem to understand the problem.
Click to expand...
Click to collapse
How about this: we'll dedicate a page to it on this site, and possibly even include a small tutorial that deals with networking stuff in general. If everyone in the know contributes a bit of their knowledge, I'll lay it all out, add the screenshots and put it on a page.
Re: private networks
Thanks.
Here's the gist of it.
Often, corporate networks use addresses in the range 10.0.0.0 - 10.255.255.255 in order to create private networks. This address range is designated for this purpose, and is the only class A range designated as such.
O2's GPRS network uses NAT in order to cut down the number of IP addresses they require. In doing so, they also use the private address range.
It is not recommended practice to use NAT for subscription networks, as they do not provide a 'complete' internet service. Certain peer-to-peer services will not work through NAT, as they require both devices to be publicly addressable - this however, is not the cause of this issue.
Lets look at the process of connecting to a VPN.
1) a 'dial up' connection is made to the GPRS service. When I say 'dial up' I do not mean a circut switched call is made (before you techies correct me), but still, some kind of PPP connection is made.
2) IP addresses are negotiated. An address is allocated to the device in the 10.0.0.0 range. During this allocation proceedure no subnet mask is specified, and the device assumes 255.0.0.0 as for a class A network.
3) The device adds a route to 10.0.0.0 mask 255.0.0.0 on the GPRS virtual adapter.
The connection to the VPN can now be made
1) a 'dial up' connection is made to the VPN service.
2) IP addresses are negotiated. An address is allocated to the device in the 10.0.0.0 range (depending on corporate config). During this allocation proceedure no subnet mask is specified, and the device assumes 255.0.0.0 as for a class A network.
3) The device adds a route to 10.0.0.0 mask 255.0.0.0 on the VPNvirtual adapter.
All seems fine - no? Try connecting to any host on the private network. Mail server, terminal server, web server. I bet you it doesn't work. That's because two routes have been allocated on the 10.0.0.0 mask 255.0.0.0 network. When you try and connect to your mail server (eg 10.0.0.6) the packets go straight out through the first matching route - the GPRS, and never even see the VPN route.
My software tool watches the route table (I use a function in the IPhlpapi.dll for those interested), and waits for a change. When it spots a change, it re-writes the routing table, narrowing the routing entries to 24 bit masks (it works out the missing octets from the gateway address).
So an example would be:
10.0.0.0 mask 255.0.0.0 gw 10.34.23.254 if GPRS
10.0.0.0 mask 255.0.0.0 gw 10.0.0.1 if VPN
becomes
10.34.23.0 mask 255.255.255.0 gw 10.34.23.254 if GPRS
10.0.0.0 mask 255.255.255.0 gw 10.0.0.1 if VPN
This allows you to access stuff in the 10.0.0.0 network.
Drawback:
You won't be able to peer to peer with other O2 XDA's who aren't on the same class C netowork - big deal, does anyone do this?
You are limited to contacting hosts on the same class C within your private network. I am working on broadening this range.
Files:
There is 1 file required - the executable, which should be placed in the startup folder. Let me know where to send this, and it can be made public.
util.
To keep you updated. I've just updated this slightly. It no longer requires MFC. It is 1 x 5.5 K executable.
Regards
Martin
Please note, not everyone will need this update. Only if your office uses a 10.0.0.0 subnet.
Thanks for all the enquiries.
Can I share the files - VPN_Access_over_mobile_web.pdf?
Hi ,
Can I share the files - VPN_Access_over_mobile_web.pdf? I am also testing the VPN conection over XDA GRPS, but if it is possible , pls mail me that PDF files. [email protected]
Thx
Li
CAn anyone please email me the VPN_Access_over_mobile_web.pdf file? Please Please Please!
Thanks
Ian
[email protected]
Don't have this file to hand, but if it is the one I think (provided by o2 UK) it is on their site somewhere.
VPN to Win2k server (with fixed ip, and internal ip of 192.168.blah-de-blah) worked first time following those instructions, as did Terminal Server used to remotely control it.
HTH
imordey said:
CAn anyone please email me the VPN_Access_over_mobile_web.pdf file? Please Please Please!
Thanks
Ian
[email protected]
Click to expand...
Click to collapse
VPN Access
For goodness sake.
http://www.o2.co.uk/mobileweb
Select the VPN Access tab!
Download the PDF from there.
A little surfing goes a long way
Re: util.
Hi Martin, I tried to mail you for the VPN fix but it bounced, any chance you could email it to me or attach it here? paul_w at cix dot co dot uk.
Thanks,
Paul
--
To: [email protected]
Subject: XDAII VPN fix
Sent: Sat, 28 Feb 2004 13:15:42 -0000
did not reach the following recipient(s):
[email protected] on Sat, 28 Feb 2004 13:30:55 -0000
The recipient name is not recognized
The MTS-ID of the original message is: c=us;a= ;p=trace computers
;l=DATA1504022813301W4WRN23
MSEXCH:IMS:Trace Computers PLCatawiseATA15 0 (000C05A6) Unknown
Recipient
martinlong1978 said:
To keep you updated. I've just updated this slightly. It no longer requires MFC. It is 1 x 5.5 K executable.
Regards
Martin
Click to expand...
Click to collapse
Does anyone have this file? Or any contact details for martinlong?
Thanks,
Paul
What VPN does for me.
Me and my significant other have 3 servers in our closet and host exchange (email), Active Directory, and outlook mobile access as well as things like ftp, web, and most importantly VPN. All my email that comes to us goes into my Outlook box on the exchange server then activesync sends a text message to my tmo pda phone and activesync begins downloading my mail and synchronizes my contacts and calendar. Once that is complete, a VPN connection is started up and the pda syncs with my desktop computer, so programs like vindigo and files like my documents are up to date. I even have the option of installing over the air or browsing my files on my computer at home.
Hey Sytris, I'm setup the same way pretty much but I've tried with 2 different devices and I can't get it to sync with the local computer. The active synce with exchange works fine and the vpn connects just fine. The active Sync app on the server then gets the connection from the PPC but shows connected as guest instead of my device and the active sync on the PPC still shows connecting but never goes anywhere. Did you run into that when setting yours up? Any suggestions? Thanks - Jim
About PPTP connection via PC I found nice tutorial step by step here at supervpn.net/blog
About mobile, you should try to contact some VPN provider, they have nice live chat support so they can answer you probably on all your questions.
For setup your vpn on your phone you can find solution on worldvpn.net
Unable to activesync over GPRS WiFi works fine
Bookmark:
Question: I have been having problems with our PDA's since Friday. We have SBS 2003 and all our PDA's are unable to activesync via GPRS.
When i connect the PDA's up to a WIFI connection they are able to activesync using that internet connection however when i try to sync using GPRS it gives the error code - 0x80072f78.
I am also unable to reach the URL via the internet explorer on the mobile phone - i.e. Http://server1/exchange unless i use the wifi connection.
I have narrowed it down to a possible carrier block however i have tried it on 3 different networks and all give the same errors? I have searched high and wide on the net and have removed the proxy from the Tytn II GPRS connection. My carrier is Orange UK.
The PDA's have been working effortlessly for the past 2years and on Friday something happened that has stopped any GPRS activesync nothing has change on our network!!!
Please help!!
Thanks
also i am unable to access OMA by visiting http://server/oma
that brings up this error
The PDA's on our network have been unable to sync OTA for 4 days now, it happened overnight and everything was working fine. When i try to access http://server1/OMA i receive the following error. Can anyone decipher what the problem is please??? I cant understand any of it !
Server Error in '/OMA' Application.
Collection was modified; enumeration operation may not execute.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
Source Error:
The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:
1. Add a "Debug=true" directive at the top of the file that generated the error. Example:
<%@ Page Language="C#" Debug="true" %>
or:
2) Add the following section to the configuration file of your application:
<configuration>
<system.web>
<compilation debug="true"/>
</system.web>
</configuration>
Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.
Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.
Stack Trace:
[InvalidOperationException: Collection was modified; enumeration operation may not execute.]
System.Collections.ArrayListEnumeratorSimple.MoveNext() +2833870
Microsoft.Exchange.OMA.Tracing.OmaTrace.set_DebugOutputTracing(Boolean value) +167
Microsoft.Exchange.OMA.UserInterface.Global..ctor() +262
ASP.global_asax..ctor() +5
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) +103
System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) +268
System.Activator.CreateInstance(Type type, Boolean nonPublic) +66
System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +1036
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +114
System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpContext context) +200
System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +114
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +350
ok for some reason ASP.NET had changed to V2 so i set it back to 1.x and i can now visit the OMA site on the server.. My PDA's are still giving the 0x80072F78 error when i try to synchronise to it though!
Hi,
I have found a really nice new program:
http://www.codeproject.com/KB/mobile/CompactDynDNS.aspx
It allows dynmic DNS Updates. So far so good, it is working very well on my Kaiser.
This tool also includes a VNCServer for WindowsMobile .
Although I get an IP from my provider for my "domain" (but I get no response with a ping !), I am not able to make a connection to my phone.
Unfortunately, the VNCServer does not create any log.
Requirements:
To use CompactDDNS, you will need:
* A DynDNS account and at least one host created
* (Free for up to 5 hosts)
* A Pocket PC phone with WM5 or WM6
* (Might work with PPC2003)
* A 3G/GPRS enabled SIM card with a ‘Public IP’
* Visual Studio 2005 with the relevant Pocket PC SDK
What does ‘Public IP’ really mean ?
Regards
kuzco1
kuzco1 said:
What does ‘Public IP’ really mean ?
Click to expand...
Click to collapse
I'm sure it means what it says - that the phone receives a public (non-internal network) IP so that the whole reason for this software works...
Some phone service providers will use a private (non-routable) IP for the phones on their network if they use proxy access... An IP in the following ranges is usually considered non-routable:
10.0.0.0/8
127.0.0.0/8
169.254.0.0/16
172.16.0.0/16
192.168.0.0/24
(these are off the top of my head, so I don't remember if I got the CIDRs correct)
If your service provider gives you one of these internal IPs, then using the DynDNS won't do any good since the IP will be wrong... And if it does detect the proper external IP, it will be of the routers or proxy server used by the carrier. And then, of course, using the VNC software won't work, either... There won't be a way to connect to it.
mcw said:
I'm sure it means what it says - that the phone receives a public (non-internal network) IP so that the whole reason for this software works...
Some phone service providers will use a private (non-routable) IP for the phones on their network if they use proxy access... An IP in the following ranges is usually considered non-routable:
10.0.0.0/8
127.0.0.0/8
169.254.0.0/16
172.16.0.0/16
192.168.0.0/24
(these are off the top of my head, so I don't remember if I got the CIDRs correct)
If your service provider gives you one of these internal IPs, then using the DynDNS won't do any good since the IP will be wrong... And if it does detect the proper external IP, it will be of the routers or proxy server used by the carrier. And then, of course, using the VNC software won't work, either... There won't be a way to connect to it.
Click to expand...
Click to collapse
Ok, sounds clear. I thought the same,but ....
I get normaly an IP i.e. 90.186.x.x or 77.24.x.x - so they are public.
Unfortunaltey I can not ping this IP (I have no FW on my movile) or get a connection via VNC.
It is possible that the provider can deny ping or remote connection?
Regards
kuzco
Go to a website like http://www.whatismyip.com/ and see if the IP it gives you is the same as what you get on the phone.
If it is, then you have a public one. If not then you are being proxied/NATed.
Now, companies can either completely or selectively block ICMP traffic to their networks quite easily via their gateway/firewall.
Will this only work with GSM phones req. "3G/GPRS enabled SIM card with a ‘Public IP’ "?
Why?
Can't you get a public ip from 3g cdma?
Hi, i'm doing a app for windows mobile and i want to connect to a web service, anyone knows how?
Thanks
Use a WebRequest to read the results.
replace ##### with the web address of the service and any parameters it wants e.g.
"http://www.webserver.com/webservice?parma=A&parmb=B"
Then use the Read() method of the stream to get the results. Remember that you can only read 8192 bytes of the stream over the net at one go. You will have to read consecutive blocks of data if the response is longer than that.
e.g.
Code:
using System.IO;
using System.Net;
Byte[] Buffer = new Byte[8192];
int ByteCount;
Stream ResponseStream = WebRequest.Create("########").GetResponse().GetResponseStream();
while ((ByteCount = ResponseStream.Read(Buffer, 0, 8192)) > 0)
{
// Do something with what's in the buffer.
}
ResponseStream.Close();
If the webservice returns XML use an XMLTextReader on the url instead
Code:
XmlTextReader xtr = new XmlTextReader(""http://www.webserver.com/webservice?parma=A&parmb=B");
Then use the Read() method to read the response a line at a time. The Name or Value properties of the class will hold the return values, depends on how the XML has been returned.
I'm doing like this, but its not connecting
connecting.StreamWS ws = new connect.connecting.StreamWS();
ws.Url = "http://192.168.56.106:9090"; //url do serviço
string strOut = ws.HelloWorld();
//textBoxResultado.Text = strOut;
MessageBox.Show(strOut);
What happens if you enter "http://192.168.56.106:9090" in the url of Internet Explorer on your Pocket PC?
nothing happens.
The network connection needs to be active?
192.xxx.xxx.xxx is part of your own network, not the web.
What is the webservice you wish to call? Where is it defined?
The webService is running on IIS. I can access it by pc browser or by a forms win app, but not by the windows mobile emulator. The application is deployed to the emulator via visual studio.
You have to configure the emulator to use your network.
From the emulator window itself, click on File -> Configure and click the network Tab. Check 'Host-only networking' and try that. If not, try adding 'Enable NE2000 adapter' and bind it to your network card.
It didn't work, i'm still getting the same error
"Could not establish connection to network."
I think the code is right
private void buttonResultado_Click(object sender, EventArgs e)
{
//Properties.Settings.Default["StreamWSTestClient_StreamingWS_Service1"] = "http://localhost:9090/";
//WindowMobileService service = new WindowMobileService();
//service = "
connecting.StreamWS ws = new connecting.StreamWS();
ws.Url = "http://mlourenco-pc:9090"; //url do serviço
string strOut = ws.HelloWorld();
//textBoxResultado.Text = strOut;
MessageBox.Show(strOut);
//textBoxResultado.Text = ws.Soma(Convert.ToInt32(textBox1.Text), Convert.ToInt32(textBox2.Text)).ToString();
}
Until you can get Internet Explorer on the emulator to display the IIS site you are wasting your time with any code at all.
Emupronet is the set up screen for the emulator.
NE2000 is the setup screen for the NE2000 adapter.
Localhost is the default under construction screen served by IIS from a default untouched website. The IP address is of the Host PC running IIS.
If the emulator's IE can't display a basic webpage served from your PC, webservices won't work either.
If your internet connection is served through a proxy, your PPC has to match, also you will have to set up the proxy details in code before it will work.
I can access internet but no IIS
Somewhat at a loss as to why it won't work. Works a treat on mine as can be seen in the post above.
Last resort, see if the emulator will work in a 'cradled' state.
From Device Emulator Manager, right click on the active emulation and select 'Cradle'. It should be preceded by a network cable icon.
You will need ActiveSync installed on the PC to be able to virtually 'cradle' it.
I already did it men, it was the f..... firewall
Thanks a lot for your help.
Now the next step is receiving a feed list and call wmp to play it, but not in web client.
Thanks
That explains it! In hindsight I should have spotted the fact you were using a different port number.
HTML goes through port :80 which is normally wide open. Non-standard port numbers are usually blocked by your firewall by default unless specifically defined.
Good luck!
Hello everyone,
I'm making a IP Scanner app in Android Studio. I have successfully checked if a PC in my LAN is Alive or Dead. But I also want to show the PC name against the IP Address.
I searched on Internet and all the solutions I found just return me the IP Address but the hostname like.
Code:
InetAddress inetAddr;
inetAddr = InetAddress.getByName(host.hostname);
String hostname = inetAddr.getHostName();
String canonicalHostname = inetAddr.getCanonicalHostName();
I also tried to execute ping -a [IP Address] in Android Terminal that also returns me IP Address not Host Name.
But If I do ping -a [My Local IP] than it returns local-host but for all other IP's it doesn't work.
This is also not a DNS issue as someone suggested on Stackoverflow, because on my windows 7 machine I'm able to resolve the hostname using ping -a [IP Address]
Both my windows machine and Android phone getting their IP from DHCP and all other settings like DNS, Gateway are same for both devices.
This was fairly easy in .Net as I have created a IP Scanner in .Net, but in Java I haven't found a solution for this yet.
Hope someone will provide a solution
Thanks