BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 03-02-2007, 03:32 AM   #1 (permalink)
New Member
 
Join Date: Feb 2007
Model: 7290
Carrier: airtel
Posts: 3
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem in getting socket connection in blackberry

Please Login to Remove!

Hi All,
In our application we are tring to establish a Socket connection to Server, resulting in an exception "Illegal argument exception" it is a simple code to connect to socket, which is compiling fine in WTK and working fine in emulators, but the same application is neither running in JDE or in my blackberry. I am trying with the following code

try {
String server = "my ip address";//serverName.getString();
String port = "my port number";//serverPort.getString();
String name = "socket://" + server + ":" + port;
SocketConnection sc = (SocketConnection)Connector.open(name, Connector.READ_WRITE,true);
is = sc.openInput();
os =sc.openOutput();
os.write(packet.getbytes());
os.flush();
} catch (Exception ex) {}


pls let me know the solution at the earliest








}
Offline  
Old 03-02-2007, 10:57 AM   #2 (permalink)
Knows Where the Search Button Is
 
Join Date: Feb 2007
Model: 9000
Carrier: SFR
Posts: 48
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

If you are using socket you need something like this:
(StreamConnection) Connection.open("socket://" + my_server + ":" + my_port + ";deviceside=true", Connectore.READ_WRITE, true);

Please note the ";deviceside=true" which is a particularity of socket connection for BB.

If you re using socket connection you woul probably experience some trouble when trying the application on a device.
Have a look on this forum to thread about APN settings/socket/ ....
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 MSA Altair 4 Altair 5 Solaris Orion Oxygen O2 Sensor, Alphasense O2-A2 O2A2
$89.0
NEW MSA Altair 4 Altair 5 Solaris Orion Oxygen O2 Sensor, Alphasense O2-A2 O2A2 pictureMsa H2s Altair Pro Single Gas Detector,10074136,cal Cert Included
$42.0
Msa H2s  Altair Pro Single Gas Detector,10074136,cal Cert Included pictureMSA Altair 4X / 5X Combustible (LEL) Replacement Sensor, P/N 10106722
$189.99
MSA Altair 4X / 5X Combustible (LEL) Replacement Sensor, P/N 10106722 pictureMSA ALTAIR 4X Phosphorescent Multigas Detector [LEL, O2, Co, H2S] - 10107603
$699.0
MSA ALTAIR 4X Phosphorescent Multigas Detector [LEL, O2, Co, H2S] - 10107603 picture safety 10071364 single gas oxygen o2 l19.5% h 18.0% altair detector
$361.56
 safety 10071364 single gas oxygen o2 l19.5% h 18.0% altair detector picture






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