Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre Companion

Notices

Reply
 
Thread Tools Search this Thread
Old 12-24-2016, 05:50 PM   #1
Wryhder
Member
Wryhder began at the beginning.
 
Posts: 19
Karma: 10
Join Date: Oct 2016
Device: Samsung Galaxy Note 10.1 (GT-N8013)
[Android] CC won't connect to Calibre

I'm using a Samsung tablet (Samsung Galaxy Note 10.1, wifi only), and a PC running Ubuntu 16.04.

The problem started a few months ago after I replaced my old USB modem.
I would usually connect to the internet on my pc, then share to my tablet.
I relied on the default connection settings in CC.
Now I use 3g wifi dongle, which can accept multiple wifi connections so I don't need to share to my tablet anymore.

I can connect to the content server just fine, but when I try to use the wireless connection, CC sees Calibre but doesn't connect. It shows that little message box about wrong IP address.

I should mention that for maybe upward of two months now, CC wouldn't even detect Calibre, no matter what I did.
I visited my dongle's web page to change it's address. From 192.168.0.101 back to it's original 192.168.0.1.
The DHCP IP pool range is from 192.168.0.100 to 192.168.0.200.
Normally, with the .101 value, my pc would take .100 and my tablet would take .101 which is the same IP as the router. It meant I couldn't access the internet on both devices simultaneously.
I didn't realize this until a few days ago. I'm still not sure if that's the problem.

So instead of connecting both devices to the dongle, I decided to connect my pc using a broadband connection then share to my tablet, just like before. [the same dongle].
When I did this, I had multiple ip addresses, non of which CC accepted. It didn't even detect Calibre most of the time.
Sometimes, I'd change something, then it would but wouldn't connect.

I've tried everything I can think of. I read CC's FAQs multiple times.
I completely turned off my firewall, I don't use an antivirus.
I've tried fixed ports and IP addresses.

I'd really appreciate some help with this.
I've relied on the content server to send books to my tablet these past months. But I've been unable to sync between both devices which is really what I need.

Here are some screenshots:

1. The usual error message.

Click image for larger version

Name:	Failed_to_connect_wrong_IP_address.png
Views:	407
Size:	769.4 KB
ID:	153751

2. Calibre recognizes my tablet when I connect via USB.

Click image for larger version

Name:	Tablet_connected_via_USB.png
Views:	414
Size:	946.8 KB
ID:	153754

3. CC finds calibre but non of these two puts me through to calibre. I should add that before I began having this problem either of these could connect CC to Calibre. Sometimes either one or the other.

Click image for larger version

Name:	Found_more_than_one_calibre.png
Views:	392
Size:	732.0 KB
ID:	153752

4. The second option connects me to the content server.

Click image for larger version

Name:	Found_more_than_one_content_server.png
Views:	418
Size:	36.4 KB
ID:	153753

5. Results of debugging device detection:

Click image for larger version

Name:	Calibre_Debug_Device_Detection.png
Views:	385
Size:	199.9 KB
ID:	153747

6. Sometimes content server and wireless connection have different addresses, which I read on CC's FAQ page is normal. I make sure the ports are different.

Click image for larger version

Name:	Calibre_different_IP_addresses_and_ports.png
Views:	402
Size:	950.6 KB
ID:	153748

7. I know it won't work but I tried to use the content server's port for the wireless connection. I get this screen, which is what I'm supposed to see if the CC successfully connects via the wireless connection.

Click image for larger version

Name:	What_I_expect_to_see_when_it_connects.png
Views:	367
Size:	775.6 KB
ID:	153755

But of course, this is next:

Click image for larger version

Name:	Content_server_port_for_wireless_connection.png
Views:	437
Size:	728.1 KB
ID:	153749


CC's log file is attached.
calibre.companion.debug.log (1).txt
Wryhder is offline   Reply With Quote
Old 12-25-2016, 06:00 AM   #2
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,362
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
It is very hard to know what is happening here.

First thing: the computer running calibre seems to have 2 IP addresses on the same subnet. That isn't a good thing. According to the debug log, CC sees:
Code:
WDConnection: Broadcasting ...
2016-12-21 11:50:28.941:  WDConnection: MDNS ServiceAdded. name=Books in calibre (on ***** port 8080), address=192.168.0.100, port=8080
2016-12-21 11:50:30.991:  WDConnection: received broadcast response calibre wireless device client (on *****);8080,9090, address 192.168.0.101
CC then attempts to connect to the .100 address, which doesn't work.

Later we see CC attempting to connect to the .101 address and succeeding
Code:
2016-12-21 11:51:11.551:  ContentServer: creating connection to http://192.168.0.101:8080/
2016-12-21 11:51:11.705:  ContentServer: checking authentication
2016-12-21 11:51:11.895:  ContentServer: creating connection to http://192.168.0.101:8080/
2016-12-21 11:51:12.073:  Feedparser got category string urn:calibre:main
2016-12-21 11:51:12.101:  Opds DataManager addData: start=0, finish=8, url=opds
As for the wireless device, something similar is happening. CC sees:
Code:
2016-12-21 11:58:30.315:  WDConnection: MDNS ServiceAdded. name=calibre smart device client (on ***** port 8090), address=192.168.0.100, port=8090
2016-12-21 11:58:32.459:  WDConnection: my ip address is: 192.168.0.102
2016-12-21 11:58:32.464:  WDConnection: trying server address 192.168.0.100 port 8090
2016-12-21 11:58:35.472:  Attempt to connect resulted in exception
java.net.SocketException: failed to connect to /192.168.0.100 (port 8090) after 5000ms: isConnected failed: EHOSTUNREACH (No route to host)
The error EHOSTUNREACH says that no computer with the IP address reported by calibre (.100) is visible on the network. This is (again) probably caused by the calibre machine having two IP addresses. Many routers cannot support two IP addresses pointing at the same MAC (device hardware) address.

In another instance, CC seems to be on the right network but calibre doesn't answer the connection request.
Code:
2016-12-21 12:00:42.929:  WDConnection: MDNS ServiceAdded. name=calibre smart device client (on ***** port 8090), address=192.168.0.100, port=8090
2016-12-21 12:00:44.984:  WDConnection: received broadcast response calibre wireless device client (on *****);8080,8090, address 192.168.0.101
2016-12-21 12:00:45.006:  WDConnection: using broadcast server address 192.168.0.101 port 8090
2016-12-21 12:00:49.984:  WDConnection: my ip address is: 192.168.0.102
2016-12-21 12:00:49.986:  WDConnection: trying server address 192.168.0.101 port 8090
2016-12-21 12:00:54.990:  Attempt to connect resulted in exception
java.net.SocketTimeoutException: failed to connect to /192.168.0.101 (port 8090) after 5000ms
This could be caused by calibre listening on only one of the IP addresses, by a firewall problem (yes, I saw you said you disabled the firewall), or by a router problem dealing with one computer on the subnet with two IP addresses.

In terms of solving this, the first thing to do is to ensure that the calibre computer has one IP address on the local subnet. Once that is true then the problems might go away. If they do not then more work is needed.
chaley is offline   Reply With Quote
Advert
Old 12-29-2016, 06:05 PM   #3
Wryhder
Member
Wryhder began at the beginning.
 
Posts: 19
Karma: 10
Join Date: Oct 2016
Device: Samsung Galaxy Note 10.1 (GT-N8013)
Thanks, Chaley.

I just got back home from school and downloaded CC to my sister's android phone.
It connected successfully, no tweaking required.
I tried to connect mine immediately afterward, and for the first time in months it did connect.

I tried a second time to be sure it wasn't a fluke. It connected.
Then my pc's wifi temporarily disconnected, and the problem started all over again. Until I connected my sister's phone. I could then connect again. I wonder why that is.
Wryhder is offline   Reply With Quote
Old 12-30-2016, 03:45 AM   #4
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,362
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Wryhder View Post
Thanks, Chaley.

I just got back home from school and downloaded CC to my sister's android phone.
It connected successfully, no tweaking required.
I tried to connect mine immediately afterward, and for the first time in months it did connect.

I tried a second time to be sure it wasn't a fluke. It connected.
Then my pc's wifi temporarily disconnected, and the problem started all over again. Until I connected my sister's phone. I could then connect again. I wonder why that is.
Are the two phones configured in exactly the same way to connect to calibre? IIRC your phone uses a fixed IP address.

Do the two phones use the same WiFi band? One might use 2.4 ghz and the other 5 ghz. If so then the router might behave differently.

What I am thinking is that there are some issues during the process of mapping an IP address to a device, and that some difference between how your sister's and your phones are connected is triggering these "issues".

The way connecting works is:
  • Every device on a network has an unchangeable (usually) physical address called the MAC (Media Access Control) address. The MAC address must be known in order to exchange network packets with a device.
  • When starting a connection, an "app" tells the OS that it wants to connect to an IP address.
  • The OS looks to see if it already knows which MAC address belongs to that IP address. Assume that it does not.
  • The OS does a "broadcast", asking all devices out there whether they have IP address X.
  • All intermediate devices (routers, hubs, etc) must relay the broadcast.
  • If a device does have that address then it replies to the broadcast sender with its MAC address. Again, all intermediate devices must relay the response.
  • The first OS puts the address into a local table so that it doesn't need to ask again.
My feeling is that your sister's phone's connection is somehow causing some intermediate device (e.g., your dongle, a router, the calibre machine) to get the correct MAC for an IP address so it doesn't need to ask later. It isn't at all obvious to me how this should happen except in the presence of "strange behavior" in one of the devices, but it does seem that some kind of pump priming is happening.
chaley is offline   Reply With Quote
Old 12-30-2016, 10:33 PM   #5
Wryhder
Member
Wryhder began at the beginning.
 
Posts: 19
Karma: 10
Join Date: Oct 2016
Device: Samsung Galaxy Note 10.1 (GT-N8013)
I began using a fixed IP on my tablet because of the connection issues.
I figured that was one less IP address to worry about.

Since CC on my sister's phone is new, it's using the default connection settings, as is mine.
Something I just remembered: my CC has four options for connecting to Calibre.
  • Wireless connection without syncing
  • wireless/sync
  • content server
  • cloud
My sister's has three. Just wireless, content server, cloud.
We're using the most recent version of CC.
I know this "varies with device" according to the additional information on Play Store.

As for the frequency band, I'm using a low-end dongle. It probably doesn't support 5 GHz, as I have not seen an option to change bands on the router's webpage.

I successfully connected to Calibre today, but it took three hours to sync about 4400 books (It used to be maybe an hour or less and this dongle is faster than the last one. Same service provider), and it disconnected twice before that in the middle of receiving books from Calibre.
I'm thankful it's connecting at all.

Here's the most recent log: calibre.companion.debug.log.txt.zip

Thanks a lot for your help.
Wryhder is offline   Reply With Quote
Advert
Old 12-31-2016, 07:08 AM   #6
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,362
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Wryhder View Post
I began using a fixed IP on my tablet because of the connection issues.
I figured that was one less IP address to worry about.

Since CC on my sister's phone is new, it's using the default connection settings, as is mine.
Something I just remembered: my CC has four options for connecting to Calibre.
  • Wireless connection without syncing
  • wireless/sync
  • content server
  • cloud
My sister's has three. Just wireless, content server, cloud.
We're using the most recent version of CC.
I know this "varies with device" according to the additional information on Play Store.
This is controlled by a CC setting in Settings / Connect to calibre. You added the "sync" option on your device but not your sisters. The difference in connections is time. When you use "Sync books" calibre must check the file date of every book on your device, something that can take a long time. In your case that process (in calibre) seems to be taking around 2 minutes.
Quote:
As for the frequency band, I'm using a low-end dongle. It probably doesn't support 5 GHz, as I have not seen an option to change bands on the router's webpage.

I successfully connected to Calibre today, but it took three hours to sync about 4400 books (It used to be maybe an hour or less and this dongle is faster than the last one. Same service provider), and it disconnected twice before that in the middle of receiving books from Calibre.
I'm thankful it's connecting at all.

Here's the most recent log: Attachment 153871

Thanks a lot for your help.
A few of things of note:
  • Networking has strange behavior. When CC connected at 2016-12-30 13:13:57, broadcasting did not find calibre. Instead CC found calibre using bonjour (mDNS). At 2016-12-30 13:34:23 both broadcast and bonjour returned the same IP address for calibre. At 2016-12-30 14:09:35, only broadcast worked. Bonjour did not reply. This level of difference shouldn't happen. If broadcast works once then it should work every time, except if the network is severely overloaded or is being poisoned by neighboring WiFi installations. If you have the tools then you might want to run a WiFi scan to see whether the WiFI channel you are using is the best one available.
  • It took CC almost 2 minutes to scan for new books. You might want to turn that option off in CC's Settings / Connecting to calibre / Wireless device settings, especially if you don't ever manually add books.
  • All formats (extensions) are enabled. You might want to turn off the ones you never use.
  • Judging from the file paths and the processing times, there is a possibility that you are seeing some of the problems described in our FAQ: I have added a lot of books and now adding books takes forever. What do I do?. However, I am not convinced. Something else seems to be affecting performance.
  • CC is taking from 1 to 4 seconds per book (and sometimes more) to update its database. This process should take around 1/2 second. There is a chance that using CC's "Clean book database" command will help (Settings / Other / Clean book database).
  • Judging from the smaller books, CC requires 0.1 second to process a book file after receiving it (save it to memory and queue the database work). This is normal.
  • Networking seems slow. For example, one book is 71,217,095 bytes long. It took CC 26 seconds to receive that book, or 2.7 MB/sec. The following book is 4,492,355 bytes long and it took CC 2.186 seconds to receive it, which is 2.1 MB/sec. CC doesn't do anything significant when receiving a book so that time must be in the device's network layer or in the network itself.

    This matters because you seem to have a lot of books longer than a megabyte. Eyeball calculation is around 20%. A significant number of books are longer than 10 megabytes.
I am not sure what more I can do. From the log, CC is behaving normally.
chaley is offline   Reply With Quote
Old 01-04-2017, 12:04 AM   #7
Wryhder
Member
Wryhder began at the beginning.
 
Posts: 19
Karma: 10
Join Date: Oct 2016
Device: Samsung Galaxy Note 10.1 (GT-N8013)
Alright, then.

I've decided to keep only a few books at a time on my tablet.
The previous decision to keep so many books in CC was in case my pc ever got irreparable damaged somehow or stolen.
But I suppose I can work around that.
As long as I don't have the problem of CC finding Calibre, it's all good.

Thanks again.
Wryhder is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calibre won't connect to iTunes (OS X) Devon Devices 73 11-26-2014 05:32 PM
Calibre won't connect to Kobo Aura HD ophelia Devices 1 11-09-2013 05:00 PM
Glo Glo Won't Connect Wirelessly to Calibre ciscopixie Kobo Reader 14 06-08-2013 03:58 AM
Calibre won't connect to Stanza Mikki_102 Calibre 2 06-15-2012 08:04 AM
Calibre won't connect to iTunes bookcroc Devices 17 02-05-2011 02:11 PM


All times are GMT -4. The time now is 02:29 PM.


MobileRead.com is a privately owned, operated and funded community.