Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Sockets and Internet Protocols
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Sockets and Internet Protocols
cannot able to reterive value comes as null
balamurugan velliambalam
Greenhorn
Posts: 20
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Using the above code i only get null value as result.It is local host only i cannot able to getvalue.
String my_url="http://192.168.6.38:8181/RayMedi_HQ/UIDisplay.do"; URLConnection con; URL url; url=new URL(my_url); con=url.openConnection(); BufferedReader br=new BufferedReader(new InputStreamReader(con.getInputStream())); String data=br.readLine(); StringBuffer sb1=new StringBuffer(); System.out.println(data); while(data!=null) { sb1.append(data); data=br.readLine(); } System.out.println(sb1.toString()); br.close();
Jinal P Shah
Greenhorn
Posts: 12
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Did you try running the URL in the browser and got the result you desire? And if it works you can try this code and see. This should work.
import java.net.*; import java.io.*; public class URLReader { public static void main(String[] args) throws Exception { URL yahoo = new URL("http://www.yahoo.com/"); BufferedReader in = new BufferedReader( new InputStreamReader( yahoo.openStream())); String inputLine; while ((inputLine = in.readLine()) != null) System.out.println(inputLine); in.close(); } }
William Brogden
Author and all-around good cowpoke
Posts: 13078
6
posted 12 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Why not use a java.net.HttpURLConnection so you can examine the returned response code and response headers?
Bill
That is a really big piece of pie for such a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
help needed regarding appending character
how to avoid null pointer exception
Unable to display the UI
Options on Opening Files
Doubt regarding StringBuffer
More...