質問

I was wondering what is the most efficient way to communicate between an android application and a java software on a computer through wifi. I used rmi by sending signal every 10 seconds to know if my devices are still connected to rmi server on my computer.

But the main problem is that use RMI to communicate is not really efficient and when many devices try to communicate with the computer I got some timeout exception because my access point can't handle all data send.

That's why I tried to find the less data consuming to communicate and know when devices are connected or not to my application. (I probably can still use RMI for punctual action but send an RMI packet every 10 seconds is probably not the best way)

Thanks.

役に立ちましたか?

解決

A direct Socket connection. Of course you'll need to come up with some sort of application level protocol there, since otherwise you're just sending bytes from one place to another.

For example, you could have the first byte tell the type of the message, and the second byte (or short) the size of a payload. Then you could send messages up to 256 (or 65536) bytes to the server and pretty much do what you want.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top