GSConnect / gnome-shell-extension-gsconnect

KDE Connect implementation for GNOME
GNU General Public License v2.0
3.23k stars 259 forks source link

Cannot share files to mobile using desktop #98

Closed ReyLeonardAmorato closed 6 years ago

ReyLeonardAmorato commented 6 years ago

I'm trying to send a file to my mobile using my desktop but nothing happens. No notifications on the phone, no notifications on the desktop. This however, is not the case with my laptop. From my laptop I can send files successfully.

I have tried:

I also made sure required dependencies are installed.

Running debug mode on GSConnect shows:

JS LOG: [gsconnect@andyholmes.github.io]: LanUploadChannel.open(25b593c95e556867)
JS LOG: [gsconnect@andyholmes.github.io]: LanChannel.send(25b593c95e556867 {"id":0,"type":"kdeconnect.share.request","body":{"filename":"Screenshot from 2018-05-12 10-54-32.png"},"payloadSize":2718158,"payloadTransferInfo":{"port":1747}})

but it stops there, on my laptop I can see more lines showing the transfer after those.

andyholmes commented 6 years ago

This seems like it might be related to #26 which was fixed in v11. Are you using v11 which is still in review or v10 from the extensions website?

ReyLeonardAmorato commented 6 years ago

I'm using v11. I tried following the steps from the link you gave me prior to posting the issue.

andyholmes commented 6 years ago

I'm not sure what could be going wrong, especially if there are no errors or further debug messages. If it sends correctly from one device, it should send from another. When this line is printed:

JS LOG: [gsconnect@andyholmes.github.io]: LanChannel.send(25b593c95e556867 {"id":0,"type":"kdeconnect.share.request","body":{"filename":"Screenshot from 2018-05-12 10-54-32.png"},"payloadSize":2718158,"payloadTransferInfo":{"port":1747}})

that means GSConnect succeeded in opening a transfer port, preparing the upload stream, sent the transfer information to the mobile device, and is now waiting for the connection to be accepted. If there were a TLS error or any other error the connection should be closed and a failed notification shown. If you have logcat on your mobile does it show any errors?

ReyLeonardAmorato commented 6 years ago

I don't have root on my phone unfortunately. Is there any way I can give you more info? I should mention that my phone and desktop are on different subnets:

Laptop: 192.168.0/24 Mobile: 192.168.0/24 Desktop: 192.168.1/24

I can use every plugin from desktop > mobile and vice versa, so connections must be coming through, right? Is there any reason for the share plugin not work under these circumstances?

EDIT: I managed to run logcat via adb. Is there a way to filter the messages to only show kdeconnect's logs?

EDIT2: Nevermind. I realised I'm in my shell and can just grep 'kde', silly me.

Here's the relevant log:

05-13 13:44:38.672 11944 31940 W System.err:    at org.kde.kdeconnect.Backends.LanBackend.LanLink.receivedNetworkPacket(LanLink.java:274)
05-13 13:44:38.673 11944 31940 W System.err:    at org.kde.kdeconnect.Backends.LanBackend.LanLink.access$000(LanLink.java:49)
05-13 13:44:38.674 11944 31940 W System.err:    at org.kde.kdeconnect.Backends.LanBackend.LanLink$1.run(LanLink.java:111)
05-13 13:44:38.681 11944 31940 E KDE/LanLink: Exception connecting to payload remote socket

More logs:

05-13 14:08:09.885 11944 31940 W System.err: java.net.ConnectException: failed to connect to /192.168.0.100 (port 1752) from /:: (port 60878): connect failed: ECONNREFUSED (Connection refused)
05-13 14:08:09.886 11944 31940 W System.err:    at libcore.io.IoBridge.connect(IoBridge.java:138)
05-13 14:08:09.887 11944 31940 W System.err:    at java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:129)
05-13 14:08:09.888 11944 31940 W System.err:    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:363)
05-13 14:08:09.889 11944 31940 W System.err:    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
05-13 14:08:09.890 11944 31940 W System.err:    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
05-13 14:08:09.891 11944 31940 W System.err:    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:356)
05-13 14:08:09.891 11944 31940 W System.err:    at java.net.Socket.connect(Socket.java:659)
05-13 14:08:09.892 11944 31940 W System.err:    at java.net.Socket.connect(Socket.java:580)
05-13 14:08:09.893 11944 31940 W System.err:    at org.kde.kdeconnect.Backends.LanBackend.LanLink.receivedNetworkPacket(LanLink.java:274)
05-13 14:08:09.894 11944 31940 W System.err:    at org.kde.kdeconnect.Backends.LanBackend.LanLink.access$000(LanLink.java:49)
05-13 14:08:09.895 11944 31940 W System.err:    at org.kde.kdeconnect.Backends.LanBackend.LanLink$1.run(LanLink.java:111)
05-13 14:08:09.895 11944 31940 W System.err:    at java.lang.Thread.run(Thread.java:764)
05-13 14:08:09.897 11944 31940 W System.err: Caused by: android.system.ErrnoException: connect failed: ECONNREFUSED (Connection refused)
05-13 14:08:09.897 11944 31940 W System.err:    at libcore.io.Linux.connect(Native Method)
05-13 14:08:09.898 11944 31940 W System.err:    at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:126)
05-13 14:08:09.899 11944 31940 W System.err:    at libcore.io.IoBridge.connectErrno(IoBridge.java:152)
05-13 14:08:09.900 11944 31940 W System.err:    at libcore.io.IoBridge.connect(IoBridge.java:130)
05-13 14:08:09.900 11944 31940 W System.err:    ... 11 more
05-13 14:08:09.902 11944 31940 E SharePlugin: Error: Nothing attached!

The IP address in the first line ... failed to connect to /**192.168.0.100** (port 1752) from /:: (port 60878): connect failed: ... is my file server/gateway. It has two NIC's one for internal network (192.168.1/24) and one (192.168.0./24) for external network. LAN is connected to a switch which connects my desktops and external network is connected to the ISP router with wifi.

The mobile connects to the ISP router directly, pointing to 192.168.0.100 as gateway.

andyholmes commented 6 years ago

Well, I guess that's probably the best explanation for why it's not working. If it's possible for you to upload from your mobile to your desktop, but not your desktop to your mobile, then it's likely a routing issue.

The downloading side is given a port to connect to by the uploading side, which is usually something that's allowed (eg. passing through firewalls, etc). For the uploader though, it opens a port between 1739 and 1764 and waits for an incoming connection, which is more like running a web server; you have to allow incoming connections on that port. If your gateway is doing any port blocking or firewalling you should have a look at that and see if you can allow those ports.

ReyLeonardAmorato commented 6 years ago

Thanks for the ELI5. I appreciate it. I guess you can go ahead and close this as it's a routing issue from my side. On an unrelated note, I want to ask you something, is that alright? How do I contact you?

andyholmes commented 6 years ago

No problem, lots of issues like these never affect me so it's helpful to know how they happen to others. If it's not an issue or feature request you can send email to the address on my Github profile page.

ReyLeonardAmorato commented 6 years ago

I decided to try and change my network topology to see if anything will change. Now the ISP router (w/ WiFi) is connected directly to the switch alongside the file server and desktops (freeing up a NIC in my server). It has the same IP subnet as the rest of the network now. Problem described here went away and I can now send files from my desktop to mobile. Thanks for your patience man. I'll drop in an email soon.