Thanks for the help!!! It works now(got rid of the timeout setting and
creating the socket elsewhere in the class. I also get the right
exceptions now, but I have no Idea why I wouldnt get them before(it
was an ip address, never a hostname and I never saw unusual traffic in
wireshark...), but well I dunno :D



On 16 Aug., 02:32, Nikolay Elenkov <nikolay.elen...@gmail.com> wrote:
> On Mon, Aug 15, 2011 at 12:16 AM, Ben <ben.v...@gmail.com> wrote:
>
> > ->If I try to set the timeout of the Socket -> null Pointer Exception
>
> Your socket is null at this point, hence the NPE. Move this code
> somewhere after new Socket(...);
>
> > ->If I try to connect to an existing address, I get the message
> > "tv.append("after socket");" but just a second after that I get "08-13
> > 20:44:05.657: ERROR/AndroidRuntime(304): Caused by:
> > android.view.ViewRoot$CalledFromWrongThreadException: Only the original
> > thread that created a view hierarchy can touch its views."
>
> You are trying to append text to a TextVie from within doInBackground()
> which executes in a separate thread. Don't do this, modify the UI only
> in pre/postExecute().
>
> > ->If I try to connect to an address that is not existing(which is exactly
> > the situation I want to simulate) I wont get any exception like "unknown
> > host" or anything it just hangs and hangs and hangs withour any error or
> > something till it kills my router with its trying(DDos anyone?) :D
>
> What address are you trying with? If it's a hostname it might be waiting
> for a DNS response. You probably need to change your router if it is
> that easy to kill :)
>
> > The whole thing worked just fine in native java and I would greatly
> > appreciate any help!!!!!
>
> Read up on the basics of Android a bit, apps are written in Java, but a
> lot of things are quite different compared to desktop/server side Java.

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to