UDP-Networking - within the Emulator

Basic Tutorials concerning: GUI, Views, Activites, XML, Layouts, Intents, ...

I'm helpless !!

Postby kingedward26 » Wed Oct 22, 2008 2:29 pm

Hello guys,
i'm really new at the android development thing!
i'm a student and i'm supposed to do this udp connection as a first step into my graduation project wich i hill hopefully post when done (well at least if it ever gets done before i die!!).
Anyways i tried this code and it doesn't seem to work or i'm stupid enough!
i don't have so much experience in network programming anyway.
so the error in the log is this :
10-22 15:21:53.750: ERROR/OSNetworkSystem(1560): unknown socket error -1
10-22 15:21:53.770: ERROR/UDP(1560): C: Error
10-22 15:21:53.770: ERROR/UDP(1560): java.net.SocketException: unknown error
10-22 15:21:53.770: ERROR/UDP(1560): at org.apache.harmony.luni.platform.OSNetworkSystem.createDatagramSocketImpl(Native Method)
10-22 15:21:53.770: ERROR/UDP(1560): at org.apache.harmony.luni.platform.OSNetworkSystem.createDatagramSocket(OSNetworkSystem.java:84)
10-22 15:21:53.770: ERROR/UDP(1560): at org.apache.harmony.luni.net.PlainDatagramSocketImpl.create(PlainDatagramSocketImpl.java:148)
10-22 15:21:53.770: ERROR/UDP(1560): at java.net.DatagramSocket.createSocket(DatagramSocket.java:193)
10-22 15:21:53.770: ERROR/UDP(1560): at java.net.DatagramSocket.<init>(DatagramSocket.java:82)
10-22 15:21:53.770: ERROR/UDP(1560): at java.net.DatagramSocket.<init>(DatagramSocket.java:67)
10-22 15:21:53.770: ERROR/UDP(1560): at com.android.udp.Client.run(Client.java:18)
10-22 15:21:53.770: ERROR/UDP(1560): at java.lang.Thread.run(Thread.java:935)

so did anyone encouter the same problem? and how you solved it!
thanks alot guys...
PLUR,
Edward
kingedward26
Freshman
Freshman
 
Posts: 3
Joined: Wed Oct 22, 2008 3:07 am

Top

Postby cslinux » Wed Oct 22, 2008 4:30 pm

Clearly having problems creating a UDP socket, i think it's related to your platform architecture at the first place
"OSNetworkSystem(1560)" or permissions issue in AndroidManifest.xml? The new SDK requires that permission for network calls.
M.R ;)
cslinux
Freshman
Freshman
 
Posts: 5
Joined: Tue Oct 21, 2008 11:04 pm

Postby kingedward26 » Wed Oct 22, 2008 7:02 pm

Thanx alot for answering so fast..
but would you have any idea on how to write the network call permission in the manifest?
what code should i add?
thanks again...
PLUR,
Edward
kingedward26
Freshman
Freshman
 
Posts: 3
Joined: Wed Oct 22, 2008 3:07 am

Postby kingedward26 » Wed Oct 22, 2008 7:23 pm

well actually i did a little research and i was able to find the permission.
it is :
<uses-permission android:name="android.permission.INTERNET" />

that's it.. this solved the problem,
thanks alot M.R. your reply was of great help.
sincerely
Edward k.
PLUR,
Edward
kingedward26
Freshman
Freshman
 
Posts: 3
Joined: Wed Oct 22, 2008 3:07 am

Postby cslinux » Wed Oct 22, 2008 7:27 pm

Check socket_programming-t325-s15.html

Thanks in advance and kind regards.
Mina ramses
cslinux
Freshman
Freshman
 
Posts: 5
Joined: Tue Oct 21, 2008 11:04 pm

Thank you for your tutorial! but... I have a problem.

Postby turlvo » Mon Mar 16, 2009 5:18 am

I try to make 'SIP communicator', but, I can't open socket.

Your tutorial also didn't work.

Could you help me something?

Thank you for reading.

bye
turlvo
Freshman
Freshman
 
Posts: 2
Joined: Fri Mar 06, 2009 6:19 am
Location: Korea, Seoul

Top

Postby donalduck0304 » Wed Oct 21, 2009 1:52 am

This example is a connection between client (android) and server (PC). So how to make a connection between 2 android (onto 2 emulators)

Thanks in advance
User avatar
donalduck0304
Freshman
Freshman
 
Posts: 6
Joined: Tue Oct 20, 2009 10:38 am

Postby p4squ1 » Mon Oct 26, 2009 4:29 pm

Why you don't post a guide to connect one client device with a server that run within the localhost?
p4squ1
Freshman
Freshman
 
Posts: 8
Joined: Fri May 15, 2009 10:18 pm
Location: Italy

Postby p4squ1 » Tue Oct 27, 2009 4:36 pm

Maybe you don't post because there isn't a way to connect one client device with a server that run within the localhost!!! :-(
p4squ1
Freshman
Freshman
 
Posts: 8
Joined: Fri May 15, 2009 10:18 pm
Location: Italy

Socket programing

Postby Annapurna » Mon Nov 09, 2009 5:14 pm

MrSnowflake wrote:If your logcat is blank, select the emulator on the left hand side of the ddms perspective.


After selecting emulator on the left hand side of the DDMs perspective also I am not able to see the communication.
Can any one help me in this respect, its too much urgent for me.
Thank you.
Annapurna
Freshman
Freshman
 
Posts: 2
Joined: Fri Nov 06, 2009 11:12 am

Phone to phone ?

Postby davidkebo » Mon Nov 30, 2009 5:47 am

Can you make this UDP connection work between two phones ?
If possible what IP and port numbers should I use ?
Thanks
David Kebo
davidkebo
Freshman
Freshman
 
Posts: 6
Joined: Sun Nov 08, 2009 8:19 pm
Location: St. Louis, MO

Postby Simple » Sun Jan 17, 2010 2:59 pm

Hi guyz the only thing i get after lunching this program is :
[2010-01-17 13:14:11 - asdasd]------------------------------
[2010-01-17 13:14:11 - asdasd]Android Launch!
[2010-01-17 13:14:11 - asdasd]adb is running normally.
[2010-01-17 13:14:11 - asdasd]Performing org.anddev.android.udpconnection.UDPConnection activity launch
[2010-01-17 13:14:11 - asdasd]Automatic Target Mode: launching new emulator with compatible AVD 'AVD_21_256'
[2010-01-17 13:14:11 - asdasd]Launching a new emulator with Virtual Device 'AVD_21_256'
[2010-01-17 13:14:12 - asdasd]New emulator found: emulator-5554
[2010-01-17 13:14:12 - asdasd]Waiting for HOME ('android.process.acore') to be launched...
[2010-01-17 13:14:48 - asdasd]HOME is up on device 'emulator-5554'
[2010-01-17 13:14:48 - asdasd]Uploading asdasd.apk onto device 'emulator-5554'
[2010-01-17 13:14:48 - asdasd]Installing asdasd.apk...
[2010-01-17 13:15:11 - asdasd]Success!
[2010-01-17 13:15:11 - asdasd]Starting activity org.anddev.android.udpconnection.UDPConnection on device
[2010-01-17 13:15:15 - asdasd]ActivityManager: Starting: Intent { cmp=org.anddev.android.udpconnection/.UDPConnection }

and the hello World, UDPConnection tekst in emulator. No log entries in DDMS anyware no ? I have added the entry to manifest and copied the code from the plusminus doeasnt seem to work
Simple
Freshman
Freshman
 
Posts: 4
Joined: Fri Jan 15, 2010 12:01 pm

Re: UDP-Networking - within the Emulator

Postby gcp1304 » Thu Dec 30, 2010 12:51 am

Hi,
Can you just let me know how to run it?
I mean i have two android devices.. So how could i use them to run this program???
gcp1304
Freshman
Freshman
 
Posts: 2
Joined: Mon May 03, 2010 7:31 am

Re: Socket programing

Postby Gaurav9527 » Thu Mar 31, 2011 6:43 pm

Annapurna wrote:
MrSnowflake wrote:If your logcat is blank, select the emulator on the left hand side of the ddms perspective.


After selecting emulator on the left hand side of the DDMs perspective also I am not able to see the communication.
Can any one help me in this respect, its too much urgent for me.
Thank you.


I am also facing the same problem, I can't see anything in the logcat window.Please guide me. Under DDMS in threads it is showing no client is selected.

Plz give any suggestions..

Thanks,
Gaurav9527
Once Poster
Once Poster
 
Posts: 1
Joined: Thu Mar 31, 2011 5:52 pm

Re: UDP-Networking - within the Emulator

Postby lam.chi.hong » Tue Aug 23, 2011 3:16 pm

Dear plusminus:
I need to thank you before, this is useful tutorial for me.
i want to develop app which send message by using WiFi.
can i using tcp/udp to do that?
in this topic, can i using button to control server and client ?
thank,
lam.chi.hong
Once Poster
Once Poster
 
Posts: 1
Joined: Tue Aug 23, 2011 3:08 pm

Top
PreviousNext

Return to Novice Tutorials

Who is online

Users browsing this forum: Alexa [Bot] and 6 guests