This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Hands On Software Engineering with Python and have Brian Allbey on-line!
See this thread for details.
Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!
  • 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
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

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:
 
No more fooling around. Read this tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!