BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 11-12-2009, 04:05 PM   #1
kwty
New Member
 
Join Date: Oct 2009
Model: 8900
PIN: N/A
Carrier: none
Posts: 4
Default Socket Programming

Please Login to Remove!

hi,

I am using Client/Server socket ( or Stream) Connection were it transfer data between both Client and Server, but the Client's socket cannot be opened. so how can i solve it???


Client code:


StreamConnection connection = (StreamConnection) Connector.open("socket://IP:PORT",Connector.READ_WRITE);

InputStreamReader isr = new InputStreamReader(connection.openInputStream());

OutputStreamWriter osw = new OutputStreamWriter(connection.openOutputStream());

osw.write(215);
osw.flush();



Server code:


server = new ServerSocket(7777, 2000);

socket = server.accept();

is = socket.getInputStream();
os = socket.getOutputStream();

int x = is.read();
Offline  
Old 11-12-2009, 05:20 PM   #2
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Default

Hard to say how to solve it if you don't say what the issue is.

I don't see any connection parameter attached to your URL, so is this a BES device?

If not, you need to review the available literature on making HTTP connections and repost your question with more info.
Offline  
Old 11-13-2009, 06:29 AM   #3
kwty
New Member
 
Join Date: Oct 2009
Model: 8900
PIN: N/A
Carrier: none
Posts: 4
Default answer

hi,

Thanks for reply, the URL= IP address:port number, and I'm using Blackberry device and BB internet service connection. Moreover, as you see i am using socket or stream connection not HTTP connection.
Offline  
Old 11-13-2009, 07:44 AM   #4
kwty
New Member
 
Join Date: Oct 2009
Model: 8900
PIN: N/A
Carrier: none
Posts: 4
Default answer

I forget to told you that I'm using a device not Emulator.
Offline  
Old 11-13-2009, 09:04 AM   #5
hrbuckley
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Default

If by BB internet service you mean BIS, then that is your problem. Unless you are an alliance member with access to BIS-B, the BIS will only support http connections. To use a TCP/IP socket you have to use direct TCP through your wireless provider, or via Wi-Fi.

See this video.
__________________
My other Blackberry is a PlayBook.

Last edited by hrbuckley; 11-13-2009 at 09:05 AM..
Offline  
Old 11-13-2009, 05:35 PM   #6
kwty
New Member
 
Join Date: Oct 2009
Model: 8900
PIN: N/A
Carrier: none
Posts: 4
Default answer

So, Can you show me how to convert my attached code previously to be HttpConnection because I didn't deal with this type of connection before,please??
Offline  
Old 11-13-2009, 07:35 PM   #7
Dougsg38p
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Default

Take a look at the HTTPDemo applicaiton that ships with the JDE.
Offline  
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


🇺🇸 Memorial Day Weekend FLASH SALE 4x6 Direct Thermal Labels (60K) picture

🇺🇸 Memorial Day Weekend FLASH SALE 4x6 Direct Thermal Labels (60K)

$199.99



Salisbury Protective Clothing Arc Flash 12 Cal Pant Bl—-3xl picture

Salisbury Protective Clothing Arc Flash 12 Cal Pant Bl—-3xl

$94.49



LP Weather Logic Seam And Flashing Tape (boxes) picture

LP Weather Logic Seam And Flashing Tape (boxes)

$200.00



York 031-02755-003 CARD FLASH YCAL EXT RANGE MMHP picture

York 031-02755-003 CARD FLASH YCAL EXT RANGE MMHP

$241.83



Stenograph Procat Flash Paper Tray, HAS A CRACK picture

Stenograph Procat Flash Paper Tray, HAS A CRACK

$12.74



Olympus Digital Voice Recorder Handheld VN-7200 Black - Tested w/case NO BOX picture

Olympus Digital Voice Recorder Handheld VN-7200 Black - Tested w/case NO BOX

$24.99







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