INTERNET

by Mitch » Thu, 20 Aug 2009 14:20:18 GMT


Sponsored Links
 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.


--~--~---------~--~----~------------~-------~--~----~



INTERNET

by John P. » Thu, 20 Aug 2009 23:23:52 GMT


 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).



--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


INTERNET

by Roman ( T-Mobile USA) » Fri, 21 Aug 2009 05:54:21 GMT


 It really depends on what you are trying to accomplish. If you want to
implement an application 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.



--~--~---------~--~----~------------~-------~--~----~



INTERNET

by Roman ( T-Mobile USA) » Fri, 21 Aug 2009 06:05:23 GMT


 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.



--~--~---------~--~----~------------~-------~--~----~



INTERNET

by Mitch » Fri, 21 Aug 2009 11:52:29 GMT


 I'm not trying to use HTTP, the "www.google.com" was just a URL I knew
would be able to respond.  Turns out that if I replace the
"www.google.com" with it's IP "74.125.53.105" then it works.  Don't
know why.

I would like to get 2 android simulators talking so I can test 2 way
communications with data.  I haven't found out how to get 2 simulators
up yet either.



--~--~---------~--~----~------------~-------~--~----~



INTERNET

by Roman ( T-Mobile USA) » Sat, 22 Aug 2009 02:08:52 GMT


 If you use an emulator try to set your DNS when you start the emulator

./emulator -dns-server <ip-address>

--
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.




--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. MediaPlayer Internal Errors when streaming mp3 from ftp site...

Can someone tell me what this error means?  This happens once in a
while when trying to play and mp3 from ftp site....

All help is greatly appreciated!

Moto!

06-07 23:11:23.806: INFO/DEBUG(2009): *** *** *** *** *** *** *** ***
*** *** *** *** *** *** *** ***
06-07 23:11:23.806: INFO/DEBUG(2009): Build fingerprint: 'generic/
google_sdk/generic/:1.5/CUPCAKE/148875:eng/test-keys'
06-07 23:11:23.806: INFO/DEBUG(2009): pid: 2411, tid: 2661  >>> /
system/bin/mediaserver <<<
06-07 23:11:23.806: INFO/DEBUG(2009): signal 11 (SIGSEGV), fault addr
d575e64e
06-07 23:11:23.806: INFO/DEBUG(2009):  r0 d5750c0a  r1 000020e0  r2
000000cc  r3 00000001
06-07 23:11:23.806: INFO/DEBUG(2009):  r4 00000198  r5 d575e64a  r6
00000000  r7 d575e4b2
06-07 23:11:23.806: INFO/DEBUG(2009):  r8 40407b24  r9 afe39dd0  10
a9d2856d  fp 00000001
06-07 23:11:23.816: INFO/DEBUG(2009):  ip 000000db  sp 40908cc4  lr
a7a22a71  pc a7a22a92  cpsr 80000030
06-07 23:11:23.977: INFO/DEBUG(2009):          #00  pc 00022a92  /
system/lib/libopencorenet_support.so
06-07 23:11:23.977: INFO/DEBUG(2009):          #01  lr a7a22a71  /
system/lib/libopencorenet_support.so
06-07 23:11:23.985: INFO/DEBUG(2009): stack:
06-07 23:11:23.985: INFO/DEBUG(2009):     40908c84  000001b4
06-07 23:11:23.985: INFO/DEBUG(2009):     40908c88  000000dc
06-07 23:11:23.985: INFO/DEBUG(2009):     40908c8c  00002bb0
06-07 23:11:23.985: INFO/DEBUG(2009):     40908c90  0000d8a8  [heap]
06-07 23:11:23.985: INFO/DEBUG(2009):     40908c94  0000da44  [heap]
06-07 23:11:23.985: INFO/DEBUG(2009):     40908c98  00000001
06-07 23:11:23.985: INFO/DEBUG(2009):     40908c9c  40407b24
06-07 23:11:24.007: INFO/DEBUG(2009):     40908ca0  afe39dd0
06-07 23:11:24.007: INFO/DEBUG(2009):     40908ca4  a9d2856d  /system/
lib/libutils.so
06-07 23:11:24.007: INFO/DEBUG(2009):     40908ca8  00000001
06-07 23:11:24.007: INFO/DEBUG(2009):     40908cac  0000da44  [heap]
06-07 23:11:24.007: INFO/DEBUG(2009):     40908cb0  00008000  /system/
bin/mediaserver
06-07 23:11:24.007: INFO/DEBUG(2009):     40908cb4  a7a22a71  /system/
lib/libopencorenet_support.so
06-07 23:11:24.007: INFO/DEBUG(2009):     40908cb8  df002777
06-07 23:11:24.007: INFO/DEBUG(2009):     40908cbc  e3a070ad
06-07 23:11:24.007: INFO/DEBUG(2009):     40908cc0  40908d1c
06-07 23:11:24.007: INFO/DEBUG(2009): #00 40908cc4  40908cdc
06-07 23:11:24.007: INFO/DEBUG(2009):     40908cc8  00019998  [heap]
06-07 23:11:24.007: INFO/DEBUG(2009):     40908ccc  a7a4ff90
06-07 23:11:24.007: INFO/DEBUG(2009):     40908cd0  40908d1c
06-07 23:11:24.007: INFO/DEBUG(2009):     40908cd4  a7a287a3  /system/
lib/libopencorenet_support.so
06-07 23:11:24.007: INFO/DEBUG(2009):     40908cd8  40407b24
06-07 23:11:24.007: INFO/DEBUG(2009):     40908cdc  a7a4d4b8
06-07 23:11:24.007: INFO/DEBUG(2009):     40908ce0  00000001
06-07 23:11:24.007: INFO/DEBUG(2009):     40908ce4  00000001
06-07 23:11:24.007: INFO/DEBUG(2009):     40908ce8  00036ce8  [heap]
06-07 23:11:24.007: INFO/DEBUG(2009):     40908cec  00000010
06-07 23:11:24.007: INFO/DEBUG(2009):     40908cf0  40908cf4
06-07 23:11:24.007: INFO/DEBUG(2009):     40908cf4  a7a4d4d8
06-07 23:11:24.007: INFO/DEBUG(2009):     40908cf8  a7a4d040
06-07 23:11:24.007: INFO/DEBUG(2009):     40908cfc  a7a4d054
06-07 23:11:24.007: INFO/DEBUG(2009):     40908d00  00000000
06-07 23:11:24.007: INFO/DEBUG(2009):     40908d04  0000d7f0  [heap]
06-07 23:11:24.007: INFO/DEBUG(2009):     40908d08  a7a1f6f1  /system/
lib/libopencorenet_support.so
06-07 23:11:25.106: WARN/AudioSystem(2529): AudioFlinger server died!
06-07 23:11:25.115: INFO/ServiceManager(537): service
'media.audio_flinger' died
06-07 23:11:25.115: INFO/ServiceManager(537): service 'media.camera'
died
06-07 23:11:25.115: INFO/ServiceManager(537): service 'media.player'
died
06-07 23:11:25.115: INFO/ServiceManager(2529): Waiting for sevice
media.player...
06-07 23:11:26.115: INFO/ServiceManager(2529): Waiting for sevice
media.player...
06-07 23:11:26.306: INFO/(2663): ServiceManager: 0xac38
06-07 23:11:26.325: INFO/AudioFlinger(2663): AudioFlinger's thread
ready to run for output 0
06-07 23:11:26.325: INFO/CameraService(2663): CameraService started:
pid=2663

--~--~---------~--~----~------------~-------~--~----~

2. How to use a CSR Wi-Fi Chip in Android?

How to use a CSR Wi-Fi Chip in Android?

and..

Unifi Drivers for the compilation process, how to?

I will wait for your answer. Thanks.

--~--~---------~--~----~------------~-------~--~----~
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

3. Visual Voice mail

4. Dynamic Widget Size

5. Change minWidth/minHeight AppWidget

6. Rado's Colorthon Tutorial Now Available on YouTube

7. Thread is stopping alone...