I don't think you want to use sockets if the receiving end isn't setup to listen for them (in your case of www.google.com). If you want to communicate with http protocol, use a Http class. It may be possible to build your own HTTP reader using sockets, but there's already one available from standard Java SDK.
The second attempt to communicate with localhost also needs a receiving listener to work. Also if you are using an emulator to access your hosting computer, use 10.0.2.2 (see http://developer.android.com/guide/appendix/faq/commontasks.html#localhostalias). On Aug 20, 2:14 am, Mitch <[email protected]> wrote: > I would like to play around with sockets to see if I can get them to > work, but I'm not having any luck. Here's what I tried: > > new Socket("www.google.com", 80); > > I've also tried > > new Socket("localhost", 7); > > but anything you can suggest that's simple is appreciated. I'm no > socket expert so I'm not sure if these are considered simple > examples. > > I read that I should add INTERNET permission to my manifest, so I did > this too: > > <?xml version="1.0" encoding="utf-8"?> > <manifest xmlns:android="http://schemas.android.com/apk/res/android" > package="com.kea" > android:versionCode="1" > android:versionName="1.0"> > <application android:icon="@drawable/icon" android:label="@string/ > app_name"> > <activity android:name=".ServSock" > android:label="@string/app_name"> > <intent-filter> > <action android:name="android.intent.action.MAIN" /> > <category > android:name="android.intent.category.LAUNCHER" /> > </intent-filter> > </activity> > </application> > <uses-sdk android:minSdkVersion="3" /> > <uses-permission android:name="android.permission.INTERNET"></uses- > permission> > </manifest> > > I'm just trying to learn so there's no real goal, just looking for a > simple example that I can get working. Any hints what I'm missing? > Thanks. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---

