Skip to content Skip to sidebar Skip to footer

Android Socket Programming Emulator Communication

I need to send messages between to emulator on same pc by the use of Socket Programming first Emulator behave Like a Server and Second one behave Like Client. But I am unable

Solution 1:

i have not tried your code, but i think you should use 70 as the SERVERPORT.


Solution 2:

The following works on my dev environment of Android Studio 4.1.1 on macOS Big Sur 11.1. It's a simple chess game over socket.

To setup port redirection on emulator, go to terminal.

to find out port number used by emulator console, run

~/Library/Android/sdk/platform-tools/adb devices

to find out authentication token, run

cat ~/.emulator_console_auth_token

to telnet emulator console, run (assuming port number is 5554)

telnet localhost 5554

to get authenticated, run

auth your_auth_token

to list active redirections, run

redir list

to add redirection, run (assuming 50000 is host port and 50001 is guest port)

redir add tcp:50000:50001

to go back to telnet prompt, press

ctrl + ]

to quit telnet, run

close

Android chess in Kotlin: https://github.com/zhijunsheng/chess-kotlin-andr

iOS chess of UIKit (used as testing socket client): https://github.com/zhijunsheng/chess-uikit-ios


Post a Comment for "Android Socket Programming Emulator Communication"