BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 08-12-2008, 06:33 AM   #1 (permalink)
New Member
 
Join Date: Aug 2008
Model: 8800
PIN: N/A
Carrier: Vodafone AU
Posts: 4
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default ServerSocketConnection exception: "Peer refused the connection"

Please Login to Remove!

Hi all,

I am trying to write a simple application which listens on a socket using javax.microedition.io.ServerSocketConnection;

It is working fine on my JDE 4.5.0 8800 simulator but when I run it on my phone I get an IOException: "Peer refused the connection".

This is the code:

try {
conn = (ServerSocketConnection)Connector.open("socket://:44474;deviceside=true");
} catch(Exception e) {
midpServerApplication.showError("Error opening server socket: "+e.toString());
return;
}

Is there some setting I need to change on the phone to make it work?

Any help would be greatly appreciated.

Regards,
Cyrus
Offline  
Old 08-12-2008, 07:11 AM   #2 (permalink)
Thumbs Must Hurt
 
Join Date: Apr 2006
Location: Boston
Model: 8900
Carrier: AT&T
Posts: 98
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Cyrus: you may need to set the APN settings on your BlackBerry. These are found at Options --> Advanced Options --> TCP. You can find out what they're supposed to be (they're service-provider dependent) at:

BlackBerry Internet - MSN/chat/web/telnet/TCPIP - No BES!

Good luck!

Cheers,

karl
__________________
Karl G. Kowalski
---------------
Owns a RAZR
Develops for BlackBerry
So next phone will be........an iPhone 3G!
Offline  
Old 08-12-2008, 08:32 AM   #3 (permalink)
New Member
 
Join Date: Aug 2008
Model: 8800
PIN: N/A
Carrier: Vodafone AU
Posts: 4
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by holy3daps View Post
Cyrus: you may need to set the APN settings on your BlackBerry.
Thanks Karl. I'm pretty sure my APN is set correctly. If I remove the APN I get a different exception:

java.io.IOException: Tunnel timed out.
Offline  
Old 08-12-2008, 11:01 AM   #4 (permalink)
Thumbs Must Hurt
 
Join Date: Apr 2006
Location: Boston
Model: 8900
Carrier: AT&T
Posts: 98
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Cyrus,

Just checking. Without the APN values you will definitely get the timeout error. The APN settings are the username/password as needed by the BlackBerry to connect to the service provider; upgrading to 4.5 from a pre-4.5 device might have foxed the settings. In addition, the simulator does not require them.

Usually you need the APN settings only to make a connection to some service on a remote machine. However, you also need them working correctly if you're setting your device up to accept incoming connections. The google search I did showed pretty much that others seeing the exception you mentioned had invalid APN settings which is why I suggested it. If yours are set correctly, then something else is going wrong.

Sorry I couldn't help.
__________________
Karl G. Kowalski
---------------
Owns a RAZR
Develops for BlackBerry
So next phone will be........an iPhone 3G!
Offline  
Old 08-12-2008, 11:23 AM   #5 (permalink)
New Member
 
Join Date: Aug 2008
Model: 8800
PIN: N/A
Carrier: Vodafone AU
Posts: 4
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks a lot Karl. BTW - how can I tell if my APN is incorrect?

I've noticed that even if I remove the APN the blackberry browser still works ok. I'm not really sure how this stuff works - any help would be appreciated.

Thanks,
Cyrus
Offline  
Old 08-13-2008, 09:16 AM   #6 (permalink)
Thumbs Must Hurt
 
Join Date: Apr 2006
Location: Boston
Model: 8900
Carrier: AT&T
Posts: 98
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Checking APN Settings

Cyrus:

There are a number of different places on the Internet that reference the BlackBerry/service-provider APN settings. You can find one of them here at BlackBerryForums:

BlackBerry Internet - MSN/chat/web/telnet/TCPIP - No BES!

Searching Google is where I originally found them in 2006. Another approach is to check with your service provider, and they should give you the information (and you can update the above link if you find the information for a provider that's not listed). Note: Be certain to get your service provider's "technical" or "Data", or "BlackBerry" customer support person, because usually the first person answering the phone doesn't know what you're talking about - in 2006 when I first went through this, Cingular's customer service had no clue what I needed, but managed to connect me to their "Data" specialist, who knew all the right answers (and from then on, I went straight to them every time).

The BlackBerry Browser is special for reasons which should be obvious . The APN settings determine how the TCP/IP connections are made, and there are ways to bypass them - I believe (translation: I haven't fully confirmed this, but...) the APN settings are appended to any URL by the OS, and the BlackBerry Browser could be accessing undocumented features of the BB OS that allow it to figure out the particular APN settings of the particular service provider if they're not available in the TCP settings. Either that, or it's going through its own RIM-owned servers and ignoring the carrier network gateway completely. Please note that these are just wild-azz guesses and are not to be taken as Truth.

Cheers,

karl
__________________
Karl G. Kowalski
---------------
Owns a RAZR
Develops for BlackBerry
So next phone will be........an iPhone 3G!
Offline  
Old 08-13-2008, 09:43 AM   #7 (permalink)
Thumbs Must Hurt
 
Join Date: Apr 2006
Location: Boston
Model: 8900
Carrier: AT&T
Posts: 98
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Check out:

Carrier internet Settings (Apn Gateway, etc) - Pinstack.com - where Blackberry Professionals Connect!

Cheers,

karl
__________________
Karl G. Kowalski
---------------
Owns a RAZR
Develops for BlackBerry
So next phone will be........an iPhone 3G!
Offline  
Old 08-14-2008, 05:07 AM   #8 (permalink)
New Member
 
Join Date: Aug 2008
Model: 8800
PIN: N/A
Carrier: Vodafone AU
Posts: 4
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks very much for the help Karl. I'll ring my service provider and hopefully get some clues.

Cheers,
Cyrus
Offline  
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





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.