BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 01-20-2009, 05:12 AM   #1
hibbert
Thumbs Must Hurt
 
Join Date: May 2007
Location: berlin, germany
Model: 8310
PIN: N/A
Carrier: vodafone
Posts: 163
Default get date from server

Please Login to Remove!

hello tehre,
i want to get a date from a webserver. now i have tried this one here:
PHP Code:
 public static void setDate() {
        
SocketConnection sc null;
        
InputStream is      null;
        
OutputStream os     null;
        
        try {
                
sc = (SocketConnection)Connector.open("socket://time-A.timefreq.bldrdoc.gov:13;deviceside=false",Connector.READ_WRITE);
                
sc.setSocketOption(SocketConnection.KEEPALIVE1);
                
sc.setSocketOption(SocketConnection.LINGER5);
                
is  sc.openInputStream();
                
os sc.openOutputStream();
                                
                
int ch 0;
                
StringBuffer sb = new StringBuffer();
                do {
                    
ch = (byte)is.read();
                    
sb.append((charch);
                } while (
is.available() > 0);
                
String erg sb.toString();
                
System.out.println(erg);
            } catch (
Exception ex) {System.out.println("Error 0x28: "+ex.toString());}
    } 
and that works fine.
but what is if the port 13 is blocked? so is therea way to get date from a webserver over port 80?

thanks hibbert
__________________
My English is so bad, that makes me nobody so quickly after
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


 TMS320LF2407APGEA  Digital Signal Processors & Controllers DSP 300pcs  picture

TMS320LF2407APGEA Digital Signal Processors & Controllers DSP 300pcs

$300.00



AB 1747-L542 /B SLC 500 5/04 CPU PROCESSOR UNIT New Factory Sealed AB 1747L542 picture

AB 1747-L542 /B SLC 500 5/04 CPU PROCESSOR UNIT New Factory Sealed AB 1747L542

$334.57



New Factory Sealed AB 1747-L541 SER C SLC 500 CPU Processor Unit Module 1747L541 picture

New Factory Sealed AB 1747-L541 SER C SLC 500 CPU Processor Unit Module 1747L541

$318.73



Allen Bradley 1747-L542 SER C SLC 500 5/04 CPU PROCESSOR UNIT AB 1747L542 picture

Allen Bradley 1747-L542 SER C SLC 500 5/04 CPU PROCESSOR UNIT AB 1747L542

$306.80



The Writer by Keyboard Instructor Word Processor Typing Trainer w/ Case picture

The Writer by Keyboard Instructor Word Processor Typing Trainer w/ Case

$30.00



ALLEN BRADLEY 2080-LC50-48QBB Micro850 EtherNet/IP Controller Brand New PLC 2022 picture

ALLEN BRADLEY 2080-LC50-48QBB Micro850 EtherNet/IP Controller Brand New PLC 2022

$333.83







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