sockets - (Android) File download normally on one host, but 'completed immediately' on another -


i'm in hurry i'll make short. if needed, i'll provide more info when pc.

i'm creating download/upload speed test app android. here's of code:

inetaddress host = inetaddress.getbyname(myhosename); socket s = new socket(host,80);  //prepare data stream 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 same test file on 2 host. (the name test.jpg)

  • one this: xxx.xxx.xxx.xxx (it's ip address)

  • another 1 domain name my.testhost.com

  • the problem when try download xxx.xxx.xxx.xxx, fine

  • but when try download my.testhost.com, download process completed next nothing being shown on logcat

i hope info enough started problem. apology i'll provide more info later, maybe tomorrow.

thanks , talk soon!

best, kitti

this looks download my.testhost.com fails , therefor appears complete immediately, although aborted. check downloaded data rule out.

a failure can happen due variety of reasons. either hostname not resolve (the lookup of ip name my.testhost.com not work), or host reachable through proxy server need configure before can make downloads.


Comments

Popular posts from this blog

php - get table cell data from and place a copy in another table -

javascript - Mootools wait with Fx.Morph start -

php - Navigate throught databse rows -