Ok guys, I figured it out. You wonβt believe it.
My servers is a virtual device for Android. I wanted to make a remote keyboard application, so I wrote a server to send each keystroke on my virtual keyboard to a client, which would then emulate my keystroke on my computer.
Problem? It worked. My client will emulate keypress on my computer, which will then emulate a keystroke on my Android emulator (if you press a key on the keyboard, it will press that key on the Android keyboard), which will send the client to press the key to press the key again, creating an endless loop .
This explains why when I focused on the eclipse window and not on the android window, the server stopped receiving numbers because the Android device stopped receiving keystrokes
Thank you for your help, although they really appreciated
source share