03-02-2007, 02: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
| 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
| |