Norman Radder wrote:Are there any error messages in the Android logcat?
Norman Radder wrote:Have you tried testing with a browser on the Android device to see if it can connect to the server on the PC?
The code would have to be altered
GET / HTTP/1.1
Host: 127.0.0.1:57908
Connection: keep-alive
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Encoding: gzip, deflate, sdch, br
Accept-Language: en-US,en;q=0.8
Norman Radder wrote:
The client code from lines 41 to 67 work with the FileServer code on my PC to send and save an image file.
GET / HTTP/1.1
Host: 192.168.1.69:57908 <<<<<<<<<<<< NOTE
Accept-Encoding: gzip
User-Agent: Mozilla/5.0 (Linux; U; Android 5.0.1; en-us; Lenovo TAB 2 A10-70F Build/LRX21M) AppleWebKit/537.16 (KHTML, like Gecko) Version/4.0 Safari/537.16 Chrome/33.0.0.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US
Accept-Charset: utf-8, iso-8859-1, utf-16, *;q=0.7
Norman Radder wrote:How do you get the IP address of the PC? I used the Fing app on my tablet.
how to connect with the browser
Norman Radder wrote:Did you try the Fing app to see what IP address the PC has?
how to connect with the browser
On the tablet, I opened a browser and entered the URL: http://192.168.1.69:57908
I posted what was sent to the PC and saved by the FileServer program in an earlier post.
Norman Radder wrote:I don't know about that code. I'm not that knowledgeable on network stuff. I've had good luck using the IP address that Fing returns.
all these (including retrieving the PC IP) need to be done programmatically.
Norman Radder wrote:
all these (including retrieving the PC IP) need to be done programmatically.
How will the Android program get the PC's IP address?
//---------------------------------------------
ipconfig
Wireless LAN adapter Wireless Network Connection:
Connection-specific DNS Suffix . : gateway.2wire.net
Link-local IPv6 Address . . . . . : fe80::bdc9:a519:ec96:52b4%22
IPv4 Address. . . . . . . . . . . : 192.168.1.69 <<<< NOTE: This is the one I used for testing - it worked
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.254
Ethernet adapter VirtualBox Host-Only Network:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::6999:b413:2af2:6eab%26
IPv4 Address. . . . . . . . . . . : 192.168.56.1 <<<<<<<<<<<< NOTE this one is returned by IP.getHostAddress()
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :
Replace the word "snake" with "danger noodle" in all tiny ads.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|