Network Connection Reset in iTunes

greenapple I consider myself an experienced IT Professional, but sometimes I just wonder what the heck is really going on. More specifically, how in the world does iTunes really work on a Windows platform? I’ve always felt that iTunes probably works just fine in an Apple ecosystem, but that the port to Windows has never been fully baked. We were trying to stream some new songs from our iTunes library but they either didn’t play or cut out at a few seconds. Time to put on my IT support hat.

I checked the Windows Explorer folder for the songs in question. They all looked fine. Sizes were right. But when I tried to play the problem tracks in Windows Media player they either stopped after a few seconds or were simply silence. Ok, I thought. Corrupt download. Delete the files and re-download my purchases.

After a bit of research to figure out how to do that, I discovered you can go to the iTunes store and find a link for past purchases. From there you can find the album or tracks that are not local and choose to download them again. That seems easy. But then the fun started.

I kept getting the infamous “network connection was reset” error. So back to Google. Oh. My. God. I found posts as far back as 2007 with people reporting this problem. The saddest part is that Apple could never fully address it. I couldn’t believe when Apple support apparently told people to look to their ISPs, routers and firewalls. Well I knew my problem was not ISP related since I’ve had this problem for a long time, even though I didn’t realize it. My son reported problems downloading purchases but eventually we got it to work so I didn’t do much digging. That was when I was on Time-Warner. This week I switched to Verizon FiOS so clearly not an ISP problem. And I have no problems with anything else Internet-related.

I found there was a new version of iTunes so I updated that. No change. Of course if this problem has been going on since at least 2007, the iTunes app isn’t fixing anything. But there is one change I read about that promised a fix. At first I ignored it because I couldn’t possibly imagine what effect it would have.

The suggestion was to change the DNS settings to a public DNS server like the ones from OpenDNS. Willing to try anything at 10PM on Thanksgiving evening, I manually set DNS to Google’s server. And it worked. And it was faster. After I recovered from the whiplash of shaking my head, I proceeded to download other tracks that had never made it. How in the world would it matter what I used for DNS to download a chunk of data? Normally I use my own internal DNS server with the usually forwarders and root hints. I never have Internet-related problems.

However, even with this change I still encountered the error so clearly this isn’t the perfect solution. I had also read about changing your download settings in iTunes to NOT allow simultaneous downloads. Once I made that change, downloads took longer but I no longer encountered the error. Of course by now it was 10:40PM EST on Thanksgiving evening so I have no way of knowing if any of those changes really made a difference or if I just got lucky.

All of this takes my back to my original rant in that iTunes on Windows is probably not the best piece of software ever written. From the limited programming I know, I am at a loss to figure out what iTunes is doing networking-wise when it comes to downloading files. From my perspective it is clearly doing something unexpected. I will have to continue to monitor iTunes. Next time I might even throw on Wireshark so I can see what is going on.

By the way, if you think you’ve had this problem, open up the root folder where you’ve told iTunes to store your music. You should see a Downloads folder. When files are downloaded from iTunes, this is the temporary folder. After the file is downloaded and processed this folder is cleaned up. But if you have had interruptions downloading files, you’ll find some temp files. I found files going back to 2012 which is why I know I’ve had this problem a while. I deleted the files first, made sure problem tracks were not showing in the library list and then tried to re-download from the iTunes store. You may need to restart iTunes.

From my research it seems the vast majority of people having this network reset error were running on some version of Windows. I have no doubt that there are many very smart developers at Apple, but sadly I suspect Windows programming is not something Apple places much value.

What has been your experience with iTunes on Windows? Any one else run into this problem and found a definitive answer?

Will Verizon FiOS Change My Life?

fiberoptic I work at home and for the longest time this has meant cable service for Internet access through Time-Warner Cable. Sadly, there was never a viable alternative so I always felt trapped. I need broadband speeds for work but had no choices, until now. Verizon recently decided to resume building out their FiOS network in my area, including my neighborhood. As you can imagine I was quite excited about the prospect of at least having an alternative. But given the promised Internet speeds and pricing it seemed like a no-brainer to switch. And I have.

The TV part of the bundle is nice so far, but personally for me it’s all about the speed. So I prepared a little before and after video.

I also tested my Yoga 2 Tablet over my wireless network. Granted, the wireless will cut down on my throughput. Here’s the before:

Yoga2-SpeedTest-1And here’s the after:

Yoga2-SpeedTest-2If I am in the same room as the access point the speeds are almost identical to my laptop.

Clearly FiOS speeds win and overall I don’t think I’m paying much more than what I was paying Time-Warner and I’m definitely receiving better value overall thus far. Verizon says to keep your old equipment and account for a bit to make sure you are happy. But I see no reason to go back.  On one hand I realize I might be trading one necessary evil for another, but for now I think I’ll enjoy the honeymoon.

Friday Fun: I’m with the band.

black-guitarI like to have fun with PowerShell, as is hopefully evident with this Friday Fun serious, and today that is especially true. Perhaps you need a quick break from the end of the week grind. Or maybe you want to learn something new about PowerShell. Hopefully today’s fun will meet both requirements. Today’s fun will include XML, scope and Switch. Let’s rock.

If you haven’t figured it out, rock ‘n roll is the theme for today. I have put together a little rock and roll quiz. In many rock bands there’s at least one member is well known. If someone says “Axl Rose” you most likely will know Guns n’ Roses. But would you recognize the other members of the band? I created an XML document with a number of well known rock bands. Because band members change, I tried to use the line ups from the bands peak years. If you want to play you will need to download BandData.xml. Save as an XML file to same directory as the script, which I’ll show you in a moment. Try not to peek too much at the contents. This is the structure.

My quiz is a PowerShell script that processes the data in the XML document. It will display a list of band members, without the recognizable lead and multiple choice of possible bands. After answering the questions you will be judged, I mean graded.

Let’s look at a few key points of the script.

First, I need to load the XML document.

The [XML] type accelerator will create an XML document. When you have an XML document in PowerShell, each node can be treated like a property so it is very easy to navigate or get values, like a list of all the band names.

The script then selects a random number of band entries from the XML document. These will be the basis of the quiz. For each item I create a list of band choices and band members that will be displayed. You’ll also noticed that I initialize some counters with the $script prefix.

Here’s why. I am using a scriptblock, defined as $promptblock, to display each question and keep track of correct answers. The scriptblock runs in a new scope, or container. That means when it tries to do something with a variable like $Q it first looks in the current scope for that item. If it finds it, it uses it. Otherwise PowerShell searches up the scope hierarchy to the parent scope looking for the item. But here’s what trips people up. If you are only reading, like I am, for things like the $bandhash object, PowerShell will happily find it in the parent scope and display it. But when I try to modify a variable like $Q or $i it can only modify it in the current scope. But I need to use those variables outside of the scriptblock scope, so I preface the variable with $Script: to indicate the scope level for those variables. The general rule is to not reference out-of-scope variables, but since I’m using $script: I’m telling PowerShell I know what I’m doing.

After running through all the questions, the script can calculate how many correct answers you had and present a score card. I decided to use a Switch statement to assist.

Normally in a Switch you would use a simple value. But you can also use PowerShell expressions. In my Switch statement, if the value of $Correct is >= 90, then I assign a certain value to $quip. When using expressions, use $_. Remember that Switch will process every matching expression and since I don’t want that, I’m using the Break keyword so PowerShell knows not to keep checking the other possibilities.

When you run the quiz, you will get an item like this:

The display is from the prompt scriptblock. If you need a little help, enter 0 which re-displays the question this time with the (hopefully) more recognizable lead.


And the final snarky commentary on your rock knowledge.

Because I am of a certain age, the contents of my band data xml file might be slightly skewed. If you were born after 1985 you might have some problems.

I think XML files scare some IT Pros but they really aren’t that difficult to work with once you understand some basics. In fact, I’ll be coming back to my band xml file in future posts. In the mean time, party on and let me know if you have any questions about my quiz script.

Advice, solutions, tips and more for the lonely Windows administrator with too much to do and not enough time.

%d bloggers like this: