Let the wookiie win
--
I changed my server to listen on port 80 instead and now it works fine
in both WIFI and MOBILE modes.
* server ping is now 800ms instead of 100ms
* I can not, of course, run a web server on the same machine now,
which is a small pain.
But hey, if it works for port 80, maybe it will work for some other
ports, and maybe I just was using the One Illegal Verizon Port In the
Entire World.
ooo. 950 ms ping... I can see why people say "plays better over wifi"
Well, at least I wasn't crazy, they really WERE blocking me.
- Dan
On Mar 17, 5:13 pm, Samsyn <d...@synthetic-reality.com> wrote:
> Sadly, no joy. I get the same behaviour trying to connect to three
> different non-port-80 servers.
>
> Recapping
>
> * using Socket, TCP connection, originated by phone
> * Have the "INTERNET" privilege
>
> code section:
>
> [code]
>
> try {
> mServerSocket = new Socket( );
> SocketAddress adr = new InetSocketAddress( (String)
> mServerAddr, mServerPort );
> mServerSocket.connect(adr, 30*1000);
> } catch (UnknownHostException e) {
> Log.v(TAG, "Unknown host" + mServerAddr );
> mLastError = "host: " + e.getMessage();
> failed = true;
> } catch (IOException e) {
> Log.v(TAG, "Couldn't get I/O for the connection to: " +
> mServerAddr );
> mLastError = "IO: " + e.getMessage();
> failed = true;
> }
> [/code]
>
> * Emulator connects just fine,whether wifi is on or off (though
> obviously the emulator uses host internet in both cases)
> * Real-Phone connects fine, in WIFI mode
> * Real-Phone fails, in MOBILE (3gs) mode, on verizon.
>
> Failure is the IOException "Socket is not connected" (and appears
> after the expected timeout)
>
> --- However, THIS works on both WIFI and MOBILE connections (initiated
> by real-phone on verizon)
>
> [code]
> URL myURL = new URL( "http://..." + mUrlArgs );
> // Open a connection to that URL.
> URLConnection ucon = myURL.openConnection();
> [/code]
>
> even to the same machine as the server that I can't connect to, but
> this is a port 80 http request.
>
> ----
>
> I'm not sure how to get deeper logging from the phone (and it only
> fails on the phone) on the off chance that some logging would actually
> tell me what it was complaining about.
>
> On Mar 15, 9:26 pm, Samsyn <d...@synthetic-reality.com> wrote:
>
>
>
> > Thanks for the suggestion Michael, I'll give that a try.
>
> > I went through some abortive experiments with
> > requestHostForConnection() (man that turned out to be a major pain)
> > and that bore no fruit (so I was happy to tear it out).
>
> > There is also a connect through proxy option which might bear fruit.
> > But maybe I should also look at the firewall logs on that server to
> > see what it says (I am of the opinion that it will accept connections
> > from anyone, but opinion is often not fact)
>
> > - Dan
>
> > On Mar 15, 10:37 am, Michael MacDonald <googlec...@antlersoft.com>
> > wrote:
>
> > > On 03/14/10 21:03, Samsyn wrote:
>
> > > > I wonder if this could be a Verizon thing. What strikes me as odd is
> > > > that the UrlConnection works fine, and that must also be using tcp, so
> > > > is fundamentally the same as my subsequent Socket connection, which
> > > > fails.
>
> > > > The differences are:
>
> > > > * different server.. .MAYBE my server doesn't like the 3gs 'ip'
> > > > address of the client...
> > > > * server port 80.. MAYBE android or verizon is making a special
> > > > exemption for what looks like a web request, while applying extra
> > > > 'security' for the more generic tcp connection
> > > > * maybe I need to do something to enable the socket-over-3gs (bind to
> > > > a nic?) That UrlCconnection is smartly doing, but I am dumbly not.
>
> > > > On Mar 12, 11:42 pm, Samsyn <d...@synthetic-reality.com> wrote:
>
> > > >> I'm sorry for what must be a really dumb question... my app is a
> > > >> client, the server is a linux box in a colo. I use android Sockets to
> > > >> connect to the server. It works great.
>
> > > >> that is, it works great when the phone is on wifi.
>
> > > >> But when the phone is on 3G, the socket connection times out.
>
> > > >> ---
>
> > > >> The ONLY permission my app is asking for is 'INTERNET' (which is
> > > >> apparently enough for it to work on wifi).
>
> > > >> What am I missing?
>
> > > >> My app also uses a URLConnection to discover the server address (by
> > > >> asking a second server, whose address is well known). That works both
> > > >> in wifi and 3G, but is a port 80 http request, so probably is
> > > >> considered pretty inoffensive. Still, it makes me feel like this is
> > > >> not some subtle radio startup issue.
>
> > > >> ---
>
> > > >> It smells like a permission issue, but reading through the
> > > >> permissions, I don't see any that scream out 'enable sockets on 3G'
>
> > > >> Note, the phone is always a client. this is not about incoming
> > > >> connections. This is an outbound TCP connection from the phone to a
> > > >> remote server (which is not a phone).
>
> > > >> It also works in the emulator, even when you tell the emulator to
> > > >> disable wifi, but I'm not sure that proves anything.
>
> > > >> Is there another permission I am missing?
>
> > > >> - Dan
>
> > > I would suspect that there is no route from the phone to your remote
> > > server. This could be Verizon shenanigans, but I don't think so because
> > > other non-port-80 apps seem to connect happily to various hosts. This
> > > suggests a problem on your server (specifically Internet-to-server)
> > > side. Try running the app on an emulator through a different ISP from
> > > one the one hosting your server: does that work?- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
No comments:
Post a Comment