Posted on Sunday January 2012
I really feel quite despondent, like I've failed. It just isn't possible to use the BOM FTP.
FTP can be in one of two modes, active or passive.
In passive we create a control channel, in which we connect, log in, and send control commands like change directory and retrieve file.
The FTP server responds with the message:
227 Entering Passive Mode (134,178,63,130,233,247)
This provides an IP Address (220.127.116.11) and port (233*256 + 247). We open a second connection to this server port. When we send a RETR message, for instance, the server streams the file back on this transmission port.
So far so good.
One additional restriction on using the sockets classes is that the destination port range that a network application is allowed to connect to must be within the range of 4502-4534. These are the only destination ports allowed by a connection from a Silverlight application using sockets. If the target port is not within this port range, the attempt to connect will fail. It is possible for a target server to receive connections on a port from this restricted range and redirect it to a different port (a well-known port, for example) if this is needed to support a specific existing application protocol.
Ahhh... that little, inconsequential restriction.
Unfortunately the rest of the internet cares not one hoot about Windows Phone 7 socket port restrictions and will continue using, in the case of the BOM, high range port numbers for FTP connections.
The logic for the port restriction is to make it easier for admins to lock down Silverlight apps and the Phone. But not much use to me.
Ah-ha! I think, How about active?
In an active connection we tell the server to open a connection to US, providing our IP Address and port number. Then we open a socket and start listening.
Only the socket on the Phone has no Listen abilities.
Which again, is reasonable, from a security perspective. More reasonable than the arbitrary port restrictions on outgoing traffic.
It's really depressing. I can connect to the FTP server, list files and directories, change directory, hell even request a file.
I just can't receive any files. Nor can I be sent any files.
It just isn't allowed. Unless you elevate to trusted. Which isn't allow on the phone.
So I give up on this idea. I can't (won't) provide a proxy. If this worked out OK I'd want to extend it to pull the weather based on location, or for multiple locations. Then I have to start proxying large amounts of the BOM's copyright data. So no go.
So what the hell, I went and signed up at the market place. I had been given a free 12 month subscription, and registration unlocks the phone to allow app deployment locally.
There are some things to be aware of when registering. You are signing up for XBOX dev as well, and it's gets a bit confusing as you end up on the xbox domain during the registration.
If you wanna get paid you also have to fill out a bunch of forms to tell the United States tax office not to tax your income. It's obviously not an Australian marketplace as such, but a US one.
Once signed up your apphub account will be associated with a windows live ID. You can then use the Windows Phone Developer Registration tool from the 7.1 SDK to register the phone as developer unlocked.
This took about ten attempts:
Eventually it decided to work.
Now we can use the Application Deployment tool form the SDK to deploy the XAP to the phone.
Just that I have no working application and I am giving up for the time being.
I need some new ideas. This time I'll:
So yeah. Bummer. I hate to say impossible, but just really, ridiculous difficult, or possible, but only if you want to root the phone or some other hack.