Hi: Can "J2ME Wireless Toolkit" support socket protocol? I try to open a server-side socket in the emulator and I program like this: server = (StreamConnectionNotifier)Connector.open("socket://127.0.0.1:1234"); but IOException and NullPointerException are thrown. Is there anything wrong in my program or the J2ME Wireless Toolkit doesn't support this? Thanks a lot in advance!! Best Regards!
Your code tries to open an socket connection to port 1234 on local machine. If you do not have a server running at that port already (you do not, since you attempt to open a server port here), you will have an IO Exception. To open server port, you can try to use datagram sockets: Examples: Datagram-based Socket - listening datagram://:1234 Datagram-based Socket - sending datagram://127.0.0.1:1234 I am not complete sure whether this will work. But you can try and let us know.
Some additional notes: The implementation of socket (inlcuding server socket) is completely dependent on the phone vendor and even the wireless carrier. On Motorola's i95cl, you can open a server port using: