UDP-Networking - within the Emulator

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

Re: UDP-Networking - within the Emulator

Postby Makaceli » Tue Dec 13, 2011 6:47 pm

I'm new to JAVA and Android, sorry for dumb questions, and for my poor English :)

When i try to compile the code, it says that i must override the run method in both Server and Client classes. Or try to delete the @Override parameter it says :)

When i delete the @Override parameter, i can compile the code but it gives "java.net.SocketException : Permission Denied" error.

How can i resolve the problem ?
Makaceli
Freshman
Freshman
 
Posts: 2
Joined: Tue Dec 13, 2011 6:40 pm

Top

Re: UDP-Networking - within the Emulator

Postby Makaceli » Tue Dec 13, 2011 7:37 pm

I also added the

<user-permission android:name="android.permission.INTERNET" />
<user-permission android:name="android.permission.NETWORK" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />

to the manifest.xml .
Makaceli
Freshman
Freshman
 
Posts: 2
Joined: Tue Dec 13, 2011 6:40 pm

Re: UDP-Networking - within the Emulator

Postby majidsaba » Thu Apr 04, 2013 9:25 pm

i get this error on DDMS

.843: D/UDP(941): S: Connecting...
.873: E/UDP(941): S: Error
.873: E/UDP(941): java.net.SocketException: socket failed: EACCES (Permission denied)
.873: E/UDP(941): at libcore.io.IoBridge.socket(IoBridge.java:583)
.873: E/UDP(941): at java.net.PlainDatagramSocketImpl.create(PlainDatagramSocketImpl.java:91)
.873: E/UDP(941): at java.net.DatagramSocket.createSocket(DatagramSocket.java:131)
.873: E/UDP(941): at java.net.DatagramSocket.<init>(DatagramSocket.java:95)
.873: E/UDP(941): at com.example.testone.Server.run(Server.java:23)
.873: E/UDP(941): at java.lang.Thread.run(Thread.java:856)
.873: E/UDP(941): Caused by: libcore.io.ErrnoException: socket failed: EACCES (Permission denied)
.873: E/UDP(941): at libcore.io.Posix.socket(Native Method)
.873: E/UDP(941): at libcore.io.BlockGuardOs.socket(BlockGuardOs.java:181)
.873: E/UDP(941): at libcore.io.IoBridge.socket(IoBridge.java:568)
.873: E/UDP(941): ... 5 more
.363: D/UDP(941): C: Connecting...
.373: E/UDP(941): C: Error
.373: E/UDP(941): java.net.SocketException: socket failed: EACCES (Permission denied)
.373: E/UDP(941): at libcore.io.IoBridge.socket(IoBridge.java:583)
.373: E/UDP(941): at java.net.PlainDatagramSocketImpl.create(PlainDatagramSocketImpl.java:91)
.373: E/UDP(941): at java.net.DatagramSocket.createSocket(DatagramSocket.java:131)
.373: E/UDP(941): at java.net.DatagramSocket.<init>(DatagramSocket.java:78)
.373: E/UDP(941): at java.net.DatagramSocket.<init>(DatagramSocket.java:63)
.373: E/UDP(941): at com.example.testone.client.run(client.java:23)
.373: E/UDP(941): at java.lang.Thread.run(Thread.java:856)
.373: E/UDP(941): Caused by: libcore.io.ErrnoException: socket failed: EACCES (Permission denied)
.373: E/UDP(941): at libcore.io.Posix.socket(Native Method)
.373: E/UDP(941): at libcore.io.BlockGuardOs.socket(BlockGuardOs.java:181)
.373: E/UDP(941): at libcore.io.IoBridge.socket(IoBridge.java:568)
.373: E/UDP(941): ... 6 more
.453: D/libEGL(941): loaded /system/lib/egl/libEGL_emulation.so
.453: D/(941): HostConnection::get() New Host Connection established 0x2a14a520, tid 941
.453: D/libEGL(941): loaded /system/lib/egl/libGLESv1_CM_emulation.so
.463: D/libEGL(941): loaded /system/lib/egl/libGLESv2_emulation.so
.513: W/EGL_emulation(941): eglSurfaceAttrib not implemented
.513: D/OpenGLRenderer(941): Enabling debug mode 0


what i should do to run proper
majidsaba
Once Poster
Once Poster
 
Posts: 1
Joined: Sun Mar 31, 2013 9:36 am

Re: UDP-Networking - within the Emulator

Postby vijaybhajantri » Sun Apr 14, 2013 5:51 pm

android emulator won't work for 127.0.0.1.. please use for localhost the alias ip 10.0.0.2
vijaybhajantri
Once Poster
Once Poster
 
Posts: 1
Joined: Sun Apr 14, 2013 5:47 pm

Top
Previous

Return to Novice Tutorials

Who is online

Users browsing this forum: No registered users and 4 guests