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

Siemens S30810-Q2216-X-6 HiPath DIU2U Module Digital Trunk Card 4475 4480
$29.99
Siemens S30810-Q2216-X-6 HiPath DIU2U Module Digital Trunk Card 4475 4480 pictureSiemens BOS16421 Fusible Switch Bus Plug 30A 240V 3Ph 4W BOS 30 Amp New in Box
$3700.0
Siemens BOS16421 Fusible Switch Bus Plug 30A 240V 3Ph 4W BOS 30 Amp New in Box pictureSiemens ED43B100 ITE Breaker 100 Amp NOS SENTRON SERIES
$75.0
Siemens ED43B100 ITE Breaker 100 Amp NOS SENTRON SERIES  pictureSiemens 3RV1021-1JA15 Motor Starter Protector 7-10 Amp 3RV10211JA15
$44.99
Siemens 3RV1021-1JA15 Motor Starter Protector 7-10 Amp 3RV10211JA15 pictureSIEMENS 3SB14 00-0H CONTACT BLOCK
$8.4
SIEMENS 3SB14 00-0H CONTACT BLOCK picture






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