Syncing with iPhone: TCP error

Discussions about the smartphone versions
DeReuf
Posts: 10
Joined: Wed Dec 02, 2009 19:15
Location: Rotterdam, Netherlands

Syncing with iPhone: TCP error

Post by DeReuf »

Hi there,
I have been working with Diving Log 4.0 on my desktop computer for abouth a month now and I'm satisfied with the functionality of this database. Last week, I got myself an iPhone and I also bought the iPhone app. However, I am unable to sync the iPhone with the desktop because of an TCP error.

The problem is as follows:
I have 58 logged dives in the desktop version. When I hit the 'Sync' button and choose 'iPod/iPhone', the Sync screen appears. Then I start the syncing procedure on the iPhone and Diving Log recognises my iPhone by stating its name:
Image

By clicking 'Send to iPhone' syncing starts and the green progress bar appears. For some reason Diving Log is NOT asking for a pairing code (!?). When the green progress bar reaches 100%, a TCP error shows up in the Sync screen:
Image

Here's the error info:
=====================================
iPhone Sync Analytics - 13-12-2009 21:10:41

Diving Log Sync Version: 1.1.0.0
Windows Version: 6.0.6002.131072
Windows Name: Windows Vista

iPhone Name: DeReuf iPhone
Sync Version:
Host Name: DeReuf-iPhone.local.
Local IP: 192.168.0.101
Port: 57266

dnssd.dll: 1.0.6.2
Ws2_32.dll: 6.0.6000.16386 (vista_rtm.061101-2205)
ZeroconfService.dll: 0.5.0.4
System.Data.SQLite.dll: 1.0.60.0
===============================

I made sure that the 'sync.exe' file has firewall permission.
I also checked the IP's of my desktop (192.168.0.103) and iPhone (192.168.0.101) and both have the same subnet mask (255.255.255.0) and that should be OK. Since Diving log states a TCP error, something is wrong with the Transfer Protocol. I checked the properties of my wireless USB-dongle, but I do not see anything strange:
Image

Or is there any problem with the TCP/IPv6 protocol? I don't know?
Any ideas? Please help!

Cheers,
Martin
divinglog
Site Admin
Posts: 5768
Joined: Sat Feb 08, 2003 21:02
Location: Coburg
Contact:

Re: Syncing with iPhone: TCP error

Post by divinglog »

Hi Martin

Yes, TCP error is in most cases a network problem. The pairing dialog appears after a successful connection, the first progressbar movement is only the database conversion on the desktop. Do you have a good wifi network indicator on your iPhone or is the connection not so good?

Please download this update of the sync tool and unzip it into the Diving Log 4.0 program folder: SyncConfig.zip

After applying this update, try the sync again. Or you can also try directly Diving Log 5.0 release candidate 1.

Cheers,
Sven
DeReuf
Posts: 10
Joined: Wed Dec 02, 2009 19:15
Location: Rotterdam, Netherlands

Re: Syncing with iPhone: TCP error

Post by DeReuf »

Thanks for your quick reply, Sven.
I'll try again tonight with the updated sync tool and check the strength of my network connection. I'll report back if my effort was succesful.
DeReuf
Posts: 10
Joined: Wed Dec 02, 2009 19:15
Location: Rotterdam, Netherlands

Re: Syncing with iPhone: TCP error

Post by DeReuf »

I've just updated the Sync file and tried to Sync the desktop with the iPhone. To make sure the wireless connection is good enough, I put my iPhone on top of the router. WifiTrak indicates a good network status:
Image

Also the network adapter of my desktop indicates an 'excellent' connection status:
Image

Still, syncing is unsuccessful? In stead of a 'TCP error', now a 'Network Error' appears in the sync screen:
Image

Please advise, since I'm completely lost here...
Cheers,
Martin
divinglog
Site Admin
Posts: 5768
Joined: Sat Feb 08, 2003 21:02
Location: Coburg
Contact:

Re: Syncing with iPhone: TCP error

Post by divinglog »

Hi Martin

You can try to connect manually as described in this tutorial: https://www.divinglog.de/english/tutoria ... config.php

Does this work? This is defenitely a strange network issue.

Cheers,
Sven
DeReuf
Posts: 10
Joined: Wed Dec 02, 2009 19:15
Location: Rotterdam, Netherlands

Re: Syncing with iPhone: TCP error

Post by DeReuf »

Unfortunately the work-around to connect manually was not succesful. Still the Network Error is appearing. I also checked the router settings but I don't see anything that could be interfering. Hmm... I have to sleep on it, because I can not think of any solution at this moment.

I have read the other thread about syncing problems:
viewtopic.php?f=7&t=956
But I can not think of any other way to improve the WiFi connection than placing the iPhone on top of the router. Did the other user use static IP adresses? The other forum thread does not explain HOW the other user increased the network connection...

Regards,
Martin
divinglog
Site Admin
Posts: 5768
Joined: Sat Feb 08, 2003 21:02
Location: Coburg
Contact:

Re: Syncing with iPhone: TCP error

Post by divinglog »

Hi Martin

OK, another try. You can try to ping the iPhone by typing in the Windows Command Prompt the word ping and following by a space and the iPhones IP address. And this is a test Greg developed to see if a connection can be established without Diving Log:
1) Open a "command prompt" on your Windows machine "Start->Programs- >Accessories->Command Prompt"

2) Type "ipconfig" at the prompt and note the "IP Address" that it prints out (something like 192.168.1.10 on your system ... in my example it is 10.0.1.187)

3) On your iPhone open the Settings application and tap on WiFi and then tap on the little blue disclosure icon on the right hand side of the row that is currently checked as the network you are connected to and note the number in the row titled "IP Address" (something like
192.168.1.12 on your system ... in my example it is 10.0.1.198)

4) Exit Settings and open Dive Log on your iPhone and navigate to the Synchronize tab and tap the little "i" in the lower right hand corner

5) Now tap the "Enable Sync" button in the upper right hand corner.
The diagnostics that print out should end with "port: 61635" ... the number will be different each time but will usually be 5 digits.

6) Now, back on your PC enter the following command:

telnet <iPhone IP address> <iPhone port number>

where <iPhone IP address> will be the number that you previously got from the iPhone Settings application
and <iPhone port number> is the port number from the Dive Log application on the iPhone from step 5
on my system the command would be:

telnet 10.0.1.198 61635

7) After you hit return the "command prompt" window should go blank and the iPhone screen should report "Connection made" which means that the iPhone and the PC can talk to each other and the problem is likely with Bonjour. If the "command prompt" windows says something like "connecting to 10.0.1.198 ..." and eventually fails, then the problem is more basic than Bonjour.

Please send me the following information in either case:

- the IP address of your PC from step 2
- the IP address of your iPhone from step 3
- the port number from Dive Log on the iPhone from step 5
- the results from telnet

If the connection worked, for extra credit :-), you can further test that communication is working by typing a lower case "v" into the "command prompt". You should see the string "Vdivelogsync 1.00"
returned from the iPhone and displayed in the "command prompt".
telnet.jpg
telnet.jpg (130.24 KiB) Viewed 15020 times
DeReuf
Posts: 10
Joined: Wed Dec 02, 2009 19:15
Location: Rotterdam, Netherlands

Re: Syncing with iPhone: TCP error

Post by DeReuf »

Again unsuccessful. Telnet is unable to communicate with the iPhone at the IP and portnumber given by DiverLog. So it must be a basic network configuration problem. The Info:
Desktop IP: 192.168.0.103
iPhone IP: 192.168.0.100
Port used: 50379 (and succeeding numbers everytime I tried)
Telnet error reads: "Could not open connection to the host, on port #####: Connection failed"

I even tried port forwarding (ports 49000-51000) in my router, but that didn't work.
I think this is one of those freakin' Vista flaws again. The iPhone does not appear on Vista's Network Map either, so somehow the Desktop does not recognise this device.

Edit: I used the ping command to see if I can reach the iPhone and that DOES work(???)
Edit2: Dammit! It DOES NOT work... Well, it does work when I use the Desktop's IP :-)
Last edited by DeReuf on Tue Dec 15, 2009 20:28, edited 1 time in total.
divinglog
Site Admin
Posts: 5768
Joined: Sat Feb 08, 2003 21:02
Location: Coburg
Contact:

Re: Syncing with iPhone: TCP error

Post by divinglog »

Maybe it has something to do with the specific port, maybe it is blocked by something. I also use Vista since the beginning, so I think it is probably something else. Do you have any other firewall installed than the internal Vista firewall? If so, try to shutdown the firewall completely. Greg is currently on vacation, he returns on Sunday, maybe he has some other ideas. I'll point him to this posting when he is back.
DeReuf
Posts: 10
Joined: Wed Dec 02, 2009 19:15
Location: Rotterdam, Netherlands

Re: Syncing with iPhone: TCP error

Post by DeReuf »

EUREKA!
As a last resort I competely shut down McAfee security centre (using Task Manager) and now it works. So, it WAS the firewall that blocked the communication (yes... you were right). I already tried once before to stop McAfee using the Services tab in Task Manager, but now I just ended the 'McAfee Integrated Security Platform' (mcagent.exe) in the Processes tab and that was succesful. It -finally- asked for a pairing code and synced the logbook.

The latest version of McAfee can not be stopped by right-clicking the icon in the system tray, do you have to work your way around it. I will do some more trials to see if this is really the solution, meanwhile you can call Greg that he can extend his holiday.

Thanks anyway Sven for responding so quickly to my postings.
divinglog
Site Admin
Posts: 5768
Joined: Sat Feb 08, 2003 21:02
Location: Coburg
Contact:

Re: Syncing with iPhone: TCP error

Post by divinglog »

That's great to hear! I'm glad it works now :)
DeReuf
Posts: 10
Joined: Wed Dec 02, 2009 19:15
Location: Rotterdam, Netherlands

Re: Syncing with iPhone: TCP error

Post by DeReuf »

Hmmm, I tried several more times and somehow the Network Error occured again. Later this week I will check if McAfee is bothering by uninstalling the McAfee software. Refer Greg to this posting anyway when he returns.

That one time hit was just a lucky shot?
divinglog
Site Admin
Posts: 5768
Joined: Sat Feb 08, 2003 21:02
Location: Coburg
Contact:

Re: Syncing with iPhone: TCP error

Post by divinglog »

I've just written Greg an email, maybe he has an idea when he comes back on Sunday.
gregm
Posts: 63
Joined: Tue Jan 06, 2009 23:04
Location: Bellingham, WA, USA
Contact:

Re: Syncing with iPhone: TCP error

Post by gregm »

This is certainly a strange connection issue. The fact that it worked one time and then not again with the same settings does point to some sort of an issue with the basic network connection. There are two things in play here. The first is the rendezvous (or zero-admin configuration) using Bonjour and the second is the actual network connection. You have successfully eliminated the rendezvous as an issue (the PC successfully gets the address and port number of the iPhone) so we are left with the actual data connection between the iPhone and the PC. The Bonjour protocol used for rendezvous does not require the PC and the iPhone to communicate directly (the iPhone publishes to the router and the PC looks up the information on the router) so the fact that you see your iPhone's name appear in the Diving Log Sync dialog does not mean that the two devices have directly communicated yet.

The fact that you can "ping" the iPhone from the PC suggests that there is valid route between the two devices. So I'm inclined to think the issue is most likely a problem with the router not forwarding the packets for the "sync service" (ping uses very low level icmp packets vs the higher level tcp packets used by the sync protocol) or a problem with the iPhone dropping the network connection shortly after it is established.

I have heard reports from a number of users about their iPhone's WiFi connection going up and down. This shows up a little more often with Dive Log's sync because it is running as a server, so when the WiFi goes down the server must stop publishing it's address and port (an Apple requirement). This is manifested by Dive Log on iPhone's Synchronization screen by the "Disable Sync" button's status being changed to "Enable Sync". The sequence of events is something like:

1. User enables sync on iPhone
2. PC sees the iPhone and starts a sync
3. The WiFi connection is dropped (and the sync service is disabled)
4. The PC tries to communicate with the iPhone (and fails)
5. The WiFi link is re-established automatically on the iPhone so it looks like it never went away.

You can tell if this is what happened by checking if the "sync" is still enabled after a network error on the PC. It will still be enabled unless the WiFi has gone up and down. Note that this issue is not related to signal strength. It seems to be a problem with the iPhone's WiFi stack.

This problem shows up with any network application, but is masked with Safari or Mail as they are client only processes and can revert to the cellular connection if WiFi goes away (Dive Log only works on WiFi). The solution, if this is the problem, is pretty easy. You can simply open the Settings application on the iPhone, select "WiFi", then tap the blue disclosure arrow for your WiFi connection, and select "Forget this Network". Then re-establish the WiFi connection and it seems this generally clears up the issue.

We may be able to narrow down the problem with the connection by eliminating the router from the equation. Since you have WiFi on your PC you can create a computer to computer network (sometimes known as an Adhoc Network) and have the iPhone connect to the PC directly. This is also useful if you want to sync your iPhone with the PC when there is no router available (like on a dive boat) so it is a good trick to know how to do anyways (I just did this all week in Belize). Here is Microsoft's instruction page for setting up an Adhoc network:

http://www.microsoft.com/windowsxp/usin ... adhoc.mspx

keep in mind that unless you also have an alternate route to the internet (like a hardwired connection) your PC will not have internet connectivity while you have the Adhoc network set up. Once you have the iPhone connected to your new Adhoc network, try the sync and see if it is any more reliable (note that it can take a while for Dive Log on iPhone to notice that it can use the Adhoc network so be patient ... the "Enable sync" button will eventually appear). You may still need to change your firewall settings on the PC depending on what they are. I currently use McAfee on my WindowsXP and Windows7 installations (I don't have Vista) and it works fine with Dive Log and Diving Log 4.0 so I'd expect that you should be able to find settings that work reliably.

Let me know if things work better with the Adhoc network and we can look to see what might be happening with your router. If the situation is the same with the Adhoc network, then we're back to looking at the iPhone and the PC.

Sorry for the initial delay in getting back to you on this.

Cheers,

Greg
DeReuf
Posts: 10
Joined: Wed Dec 02, 2009 19:15
Location: Rotterdam, Netherlands

Re: Syncing with iPhone: TCP error

Post by DeReuf »

Thanks fro getting into this, Greg (Hope you had a nice holiday by the way!). Last week when I discussed this issue with Sven I left off where I tried some pinging. I was not completely confident over the IPv6 protocol, so I used the ping command in combination with -4 (force to use IPv4) and -6 (forced to use IPv6).
I was suprised about what I ran into. As you can see from the following screendump, I suddenly lost connection to the iPhone and was not able to ping it anymore...

So most likely it IS a WiFi problem. I will try to connect it by using an ad-hoc connection, but that will most likely be after X-mas. I'll report the results here.

Have a nice X-mas!

Screendump:
Image
Post Reply