BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 10-04-2007, 06:06 AM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: May 2007
Location: Bulgaria
Model: none
PIN: N/A
Carrier: Mtel
Posts: 150
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Socket Connection Problem!!!

Please Login to Remove!

I make a SocketConnection like this :

Code:
private void connect() throws IOException, ControlledAccessException, IllegalArgumentException {
    socket = (SocketConnection) Connector.open(link);
    socket.setSocketOption(SocketConnection.KEEPALIVE, 0);
    socket.setSocketOption(SocketConnection.LINGER, timeout);
  }
where link is:
Code:
String link = "socket://some host:some port;deviceside=true"
Sometimes I cannot set the connection i.e. the connect() method throws IOException. It is not all the time but sometimes. do you have an idea what is going on?
Offline  
Old 10-08-2007, 08:26 PM   #2 (permalink)
Thumbs Must Hurt
 
Join Date: Jun 2007
Model: 8800
PIN: N/A
Carrier: GPRS
Posts: 68
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Maybe you can delete the two:
" socket.setSocketOption(SocketConnection.KEEPALIVE, 0);
socket.setSocketOption(SocketConnection.LINGER, timeout);
"
just use the default configuration.
Offline  
Old 10-09-2007, 01:54 AM   #3 (permalink)
Thumbs Must Hurt
 
Join Date: May 2007
Location: Bulgaria
Model: none
PIN: N/A
Carrier: Mtel
Posts: 150
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi, I found the problem. When I opened the connection, I opened the Input and Output streams ,but when I close the connection I don't close the streams so when I made a lot of input and output streams opened it throws an IOException: max connections opened. So the problem is solved .

Code:
connect();
      InputStream in = socket.openInputStream();
      OutputStream out = socket.openOutputStream();
      //..... some code
      in.close();
      out.flush();
      out.close();
      socket.close();
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

NEW CENTILLIUM VOIP CPU PROCESSOR IC CHIP CT-GWC4672-FA-AB (S17-3-28H)
$4.99
NEW CENTILLIUM VOIP CPU PROCESSOR IC CHIP CT-GWC4672-FA-AB  (S17-3-28H) pictureLOT OF 25 Cisco CP-7942G Unified IP Phone - voip phone - used
$299.0
LOT OF 25 Cisco CP-7942G Unified IP Phone - voip phone - used pictureCisco 7960 Unified VOIP IP Phone System for Business-POE-Office CP-7960G
$6.25
Cisco 7960 Unified VOIP IP Phone System for Business-POE-Office CP-7960G pictureAscom Telligence HC-ANNUN-3K RPA Colortouch VoIP annunciator
$115.0
Ascom Telligence HC-ANNUN-3K RPA Colortouch VoIP annunciator pictureAdtran IP706 IP 706 1200769E1#B 1200769E1 Display VoiP Phone
$24.5
Adtran IP706 IP 706 1200769E1#B 1200769E1 Display VoiP Phone  picture






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