Search code examples
java-meudpdatagram

Is it right to send data in J2ME through cable by mean of DatagramConnection?


I want to send data by using J2ME between a mobile phone and a computer. The two machines are connected by the phone's cable : there is no Wi-Fi , no http connection , no Internet. So is it wrong or correct to use the J2ME DatagramConnection to send data to the computer when the mobile's cable is inserted to the USB port of the computer ?


Solution

  • When you talk about interaction between two systems, first you will need to address the connectivity. In the situation described, the connectivity between the phones is via USB, which is a serial port. So the communication can be done over serial port only.

    Datagram can be used over IP networks and other specialized networks.

    If for some reason you are unable to communicate via USB, check if you could connect both of them using Bluetooth. If your phone has Bluetooth and the computer doesn't, then you could purchase an USB Bluetooth Dongle for very cheap.

    If you are trying to get logs of your application, you can check out Bluetooth loggers for J2ME. There are quite a lot of them. One such library is microlog

    Hope this helps.