• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Ron McLeod
  • Tim Moores
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Vijitha Kumara

J2ME for socket  RSS feed

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You may want to check out http://www.beacontower.net.
 
author
Posts: 1427
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Michael Yuan
author
Posts: 1427
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
BWA HA HA HA HA HA HA! Tiny ad:
global solutions you can do in your home or backyard
https://coderanch.com/t/708587/global-solutions-home-backyard
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!