×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Regular Contributor
    Join Date
    Jun 2004
    Location
    Lithuania
    Posts
    63

    Can not read data from URL.

    Hello,
    I want to read data from URL (http://84.100.130.82:8000/;stream.nsv). But can not do it. Because when try to call function openDataInputStream() shows this error: java.io.IOException: response does not start with HTTP it starts with: ICY.
    How I can fix this bug?

    Code:
    HttpConnection c = null;
    InputStream is = null;
    OutputStream os = null;
    StringBuffer b = new StringBuffer();
    String 		response,
    responseLitle;
    c = (HttpConnection)Connector.open(“http://84.100.130.82:8000/;stream.nsv”);
    os = c.openOutputStream();
    os.flush();
    is = c.openDataInputStream();	// ERROR CODE HERE
    int ch;
    // receive output
    while ((ch = is.read()) != -1) 
    {
    b.append((char) ch);
    }
    response = b.toString();
    Regards, Ramunas

  2. #2
    Super Contributor
    Join Date
    Mar 2006
    Location
    Phoenix, AZ. USA
    Posts
    556

    Re: Can not read data from URL.

    try using a socket connection instead of httpconnection...

    what are you doing this optional paramter for ";stream.nsv", i have never seen it, but may not be hindering your code...

    and you should always get the response code, from the httpconnection, before do the I/O, so it flushes the headers and creates the connection with web server

    though, also, that does not seem to be the problem...
    Jason Glass
    http://IChiBanComputers.Com

  3. #3
    Regular Contributor
    Join Date
    Jun 2004
    Location
    Lithuania
    Posts
    63

    Re: Can not read data from URL.

    thanks for answer. I replace HttpConnection to SocketConnection and works fine.

  4. #4
    Super Contributor
    Join Date
    Mar 2006
    Location
    Phoenix, AZ. USA
    Posts
    556

    Re: Can not read data from URL.

    Nice! Glad I could help!
    Jason Glass
    http://IChiBanComputers.Com

  5. #5
    Regular Contributor
    Join Date
    Nov 2007
    Posts
    193

    Lightbulb Re: Can not read data from URL.

    hello guys ,
    i was searching about my problem and i found your thread.
    if anyone of you see this ;Please help me
    i am facing the same problem i want to fetch this and want to take out some info...
    http://www.google.co.uk/search?hl=en&q=GBP+in+USD&meta=
    what i should use http or socket
    please give me some code clues.
    thanks in advance

  6. #6
    Regular Contributor
    Join Date
    Aug 2006
    Location
    Spain
    Posts
    63

    Re: Can not read data from URL.

    Take a look at this thread.

  7. #7
    Registered User
    Join Date
    Aug 2006
    Posts
    33

    Re: Can not read data from URL.

    It the response start with ICY, it is streaming radio format. You may try this http://www.getjar.com/products/13881/

Similar Threads

  1. Problem in reading data from socket
    By srkreddy999 in forum Symbian Networking & Messaging (Closed)
    Replies: 5
    Last Post: 2009-07-06, 16:05
  2. [urgent] pls help me --- about read data from txt file
    By goldkam in forum Mobile Java General
    Replies: 1
    Last Post: 2006-01-06, 01:09
  3. Read Data From Message
    By @nakin in forum Symbian
    Replies: 2
    Last Post: 2004-03-04, 19:09
  4. Listbox - how to read data at index
    By asangamneheri in forum Symbian User Interface
    Replies: 1
    Last Post: 2003-02-13, 16:06
  5. What is the real problem to receive data calls with Nokia TDMA cel modems?
    By jackal_jr in forum PC Suite API and PC Connectivity SDK
    Replies: 1
    Last Post: 2002-12-09, 09:02

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×