BlackBerry Forums Support Community

Closed Thread
LinkBack Thread Tools
Old 07-31-2008, 11:07 AM   #1 (permalink)
Knows Where the Search Button Is
Join Date: Jun 2008
Model: pearl
Carrier: none
Posts: 20
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default ServerSocketConnection

Please Login to Remove!


I am trying to make a j2me server that would listen for incomming requests. I create a socket conmnection for the same and try to listen port. However the simulator seems to open the socket (based on debug info only) but there is no external connection or access. Even another internal program on the simulator cannot access the server on the specified port .

On further investigation it turns out that the getlocaladdress method returns weird characters and System.getProperty on hostname returns null.

Any idea what the problem might be? it should be with the ports and opening and something there ? Any help would be greatly appreciated.

The code is as follows:
public void run(){
				ServerSocketConnection server= null;
				try {
					server = (ServerSocketConnection)"socket://:"+port);
					update("server started on port "+ server.getLocalPort()+" "+ server.getLocalAddress()+"on "+System.getProperty("microedition.hostname"));
				} catch (IOException e1) {

				while (true) {
					try {
						SocketConnection client;

						client = (SocketConnection) server.acceptAndOpen();
Old 07-31-2008, 12:59 PM   #2 (permalink)
BlackBerry Extraordinaire
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Post Thanks: 20
Thanked 77 Times in 68 Posts

I don't think this will work unless your blackberry is provisioned with a public IP address. With our carrier we can do this by subscribing to VPN support, other wise I believe the device is behind a NAT wireless to IP gateway of some kind.

The only way I've found to do what you want is by using the MDS push protocol (which has a similar pattern to the server socket) that comes along with the BES and Unite servers. The MDS simulator provides the same for the BB simulator.

It is possible that a recently announced protocol called Web Signals may provide the same capabilities without BES/Unite but I'm still waiting for detailed information from RIM on that. If you are a member of, or qualify for membership in the Blackberry Developer Network information is available there, apparently.
Closed Thread

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Jelenko Commodore 100 Dental Laboratory Oven/Furnaces 120V - for Parts
Jelenko Commodore 100 Dental Laboratory Oven/Furnaces 120V - for Parts picturePhoenix CPS 10 Commodore 64 C-64 Power Supply Untested 14084
Phoenix CPS 10 Commodore 64 C-64 Power Supply Untested 14084  pictureReconditioned Windsor Commodore 20 Carpet Extractor
Reconditioned Windsor Commodore 20 Carpet Extractor picture100% Working Guaranteed VIC-20 Power Supply 902502-02 7
100% Working Guaranteed  VIC-20 Power Supply 902502-02     7 pictureWindsor Commodore carpet extractor
Windsor Commodore carpet extractor  picture

Copyright 2004-2016
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.