This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Java Micro Edition and the fly likes J2ME for socket Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Mobile » Java Micro Edition
Reply Bookmark "J2ME for socket" Watch "J2ME for socket" New topic
Author

J2ME for socket

ying qu
Greenhorn

Joined: Jun 20, 2002
Posts: 13
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!

Ying


ying qu
Hearth Stone
Greenhorn

Joined: Sep 20, 2002
Posts: 2
You may want to check out http://www.beacontower.net.
Michael Yuan
author
Ranch Hand

Joined: Mar 07, 2002
Posts: 1427
Originally posted by ying qu:

server = (StreamConnectionNotifier)Connector.open("socket://127.0.0.1:1234");
but IOException and NullPointerException are thrown.

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.


Seam Framework: http://www.amazon.com/exec/obidos/ASIN/0137129394/mobileenterpr-20/
Ringful: http://www.ringful.com/
Michael Yuan
author
Ranch Hand

Joined: Mar 07, 2002
Posts: 1427
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:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: J2ME for socket
 
Similar Threads
Creating Input Stream Error
J2ME and JSR 172
location class in netbeans ide
deloyping MIDLET on any server
Installing J2ME tools and SDK on Linux Platform