Reputation: 1019
I'm in a hurry so I'll make this short. If needed, I'll provide more info when I get back to my PC.
I'm creating a download/upload speed test app for Android. Here's some of the code:
InetAddress Host = InetAddress.getByName(myHoseName);
Socket s = new Socket(Host,80);
//prepare data stream for each direction
OutputStream output = s.getOutputStream();
InputStream input = s.getInputStream();
//send command
output.write( ("GET "+ myFilePath +" HTTP/1.0\r\n").getBytes() );
output.write("Accept: */*\r\n".getBytes());
output.write("\r\n".getBytes());
while ((DownloadedByte += input.read(BufferData,0,BufferData.length)) != -1)
{
//download started... bla bla bla
The problem:
I have the SAME test file on 2 host. (the name is test.jpg)
One look like this: xxx.xxx.xxx.xxx (it's an IP address)
Another one is a domain name like my.testhost.com
The problem is when I try to download from xxx.xxx.xxx.xxx, everything is fine
But when I try to download from my.testhost.com, the download process completed immediately with next to nothing being shown on Logcat
I hope this info is enough to get started with the problem. My apology but I'll provide more info later, maybe tomorrow.
Thanks and talk to you soon!
Best, Kitti
Upvotes: 0
Views: 168
Reputation: 6640
This looks very much like the download from my.testhost.com fails and therefor appears to complete immediately, although it only aborted. Check the downloaded data to rule this out.
A failure can happen due to a variety of reasons. Most likely are that either the hostname does not resolve (the lookup of the IP for the name my.testhost.com does not work), or the host is reachable only through a proxy server that you would need to configure before you can make downloads.
Upvotes: 1