It really depends on what you are trying to accomplish. If you want to
implement a simple application using sockets you can try
so setup a server on your desktop and execute the following commands
from the Android device
Socket s = new Socket("<IP address of server", <port
on desktop>);
PrintWriter out = new PrintWriter(s.getOutputStream(),
true);
out.println("Hello World");
The server should listen on the port you have specified in your
Android app. If you don't want to implement any server you also can
download netcat. It is a very powerful TCP/IP testing tool.
--
Roman Baumgaertner
Sr. SW Engineer-OSDC
·T· · ·Mobile· stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.
On Aug 19, 11:14 pm, 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
-~----------~----~----~----~------~----~------~--~---