Connecting to http web site using java socket

Hi,
Sockets in Java I believe are reusable. Once created, it can be used to send a request using its input stream and get back a response using the output stream. My problem is I am trying to connect to a website using java socket but I am unable to get a response (though the same works fine I use URL and URLConnection). Can anyone tell me whats wrong? Below is the client program:
public class HttpAdapterTest {
     public static void main(String[] args) {
          try {
               Socket socket = new Socket("www.google.com", 80);
               BufferedWriter out = new BufferedWriter(
                              new OutputStreamWriter(socket.getOutputStream()));
               out.write("GET /help/basics.html HTTP/1.1");
               out.flush();
               BufferedReader in = new BufferedReader(
                                        new InputStreamReader(ucon.getInputStream()));
               String line = null;
               while((line = in.readLine()) != null) {
                    System.out.println(line);
               in.close();
          } catch (Exception e) {
               e.printStackTrace();
}

Look at the JSSE examples. You need to setup a key store, add the jsse jars to your classpath, yadda, yadda, yadda....

Similar Messages

  • Resources for implementing HTTP web server using java

    hi ,
    Thanks for giving your precious time in reading the message.I want to build a HTTP web server using java,which will run on my machine and I can communicate with it through web browser(IE) using HTTP requests and response.
    I know java language, but quite new to network programming.I want to gain enough knowledge on network programming in java.Can you please suggest me good books or any other resources available on the internet for the required subject.Any help will be greatly appreciated.
    my email-id is : [email protected]

    hi there my friend,
    I am writing my own web server too. in w3c there is a sample web server called jigsaw-open source :) and simple-
    I do think it worth trying.
    you can contact me if you want to share some source and info. cause I will.
    [email protected]
    but within 2 weeks I will be back for studying for my web server. you have to wait for a while.

  • I can not connect to a web site using aol/ google with safari , only yahoo will connect to the site

    I find i can only connect to some sites using yahoo.  google and aol will not allow me to connect , what do I do?

    First off, AppleTV doesn't give web access.
    Second off, Apple's classic operating system compatibility with many websites is very limited.  That's the operating system available in virtualization on Macs made prior to early 2006, and as a boot operating system on Macs on or before 2003.  
    So without knowing what you have that is compatible, we can't give you really good advice on what to make it work.  Identify your Mac, if you have one:
    http://discussions.apple.com/docs/DOC-2881
    And tell us what version of the Mac OS you have in Apple menu -> About This Mac.    Mac OS 10.0.x does not run on AppleTV.    Then we can tell you what operating system support you should be able to get, and what browser support you should be able to get.

  • The web site uses java is this available for mozilla moble and if so where can i get it?

    tried to view a camera feed through the web site when i did it with my pc i had to add a java add-on but i can't find one for the mobile version...do you have any suggestions
    thanks

    https://support.mozilla.com/en-US/questions/815161
    No Java for Android yet.
    The Oracle vs. Google Android lawsuit does not help either.
    http://www.zdnet.com/blog/open-source/oracle-vs-google-android-java-lawsuit-settlement-talks-will-go-no-where/9580

  • I am trying to connect to a web site using kiosk software and can not connect to a page.

    I have been using both eCrisper and Kiosk Pro and trying to connect to our church's online giving page (crossing-church.logosconnect.com) and the page will not load.  The page loads fine in Safari.  The developer for eCrisper says it is an Apple issue.  Any thoughts?

    There are 2 versions of Adobe Flash:
    *the Plugin version for Firefox and most other browsers
    *the ActiveX version only for IE (see: [[ActiveX]])
    *When updating, you need to update '''both'''
    You do not have the Plugin version installed for Firefox. Look for "Shockwave Flash" in Tools > Add-ons > Plugins
    #'''Install the [[Managing the Flash plugin|Flash]] plugin''' to the latest version.
    #*Download and SAVE to your Desktop so you can find the installer later
    #*If you do not have the current version, click on the "Player Download Center" link on the "'''Download and information'''" or "'''Download Manual installers'''" below
    #*After download is complete, exit Firefox
    #*Click on the installer you just downloaded and install
    #**Windows 7 and Vista: may need to right-click the installer and choose "Run as Administrator"
    #*Start Firefox and check your version again or test the installation by going back to the download link below
    #*'''Download and information''': http://www.adobe.com/software/flash/about/
    #**Use Firefox to go to the above site to update the Firefox plugin (will also install plugin for most other browsers; except IE)
    #**Use IE to go to the above site to update the IE ActiveX
    #*'''Download Manual installers'''.
    #**http://kb2.adobe.com/cps/191/tn_19166.html#main_ManualInstaller
    #**Note separate links for:
    #***Plugin for Firefox and most other browsers
    #***ActiveX for IE

  • On certain web sites(with java applets embedded or rich content),sometimes browser hotkeys are beeing used with other functionality (eg.: youtube uses ctrl + tab for sliding between player controls).How can I prevent this?

    On certain web sites(with java applets embedded or rich content),sometimes browser hotkeys are beeing used with other functionality (eg.: youtube uses ctrl + tab for sliding between player controls).How can I prevent this ?

    Thanks for posting this!
    I would only mention that your definition is incomplete for this -
    Contextual selector A type of Style Sheet Selector that
    and that it's most often referred to now as a Descendent selector, not a contextual selector.  It's basically the same as the Compound selector that you have already defined....

  • My wife and I share our Mac OS 10.6.8 since downloading Skype on her account she can not stay connected to any web site she pulls up. I removed Skype from here account but it stll happens. What can I do to clear this up?

    My wife and I share the same Mac OS 10.6.8 and since downloading Skype on her accout she came not asty connected to any web site for more than a few seconds. I have remove Skype from her account but not mine. I don't have the problem on my accout and I still have Skype loaded. How can I fix this problem?

    O.k. Thanks for the clarification. I poked around in my TimeCapsule router's settings (TimeCapsule is an Apple Airport Extreme router with attached hard drive for wireless backup/storage). Unfortunately, it doesn't look like I can disable multicasting with the TimeCapsule. I can change the multicasting 'rate'. Settings are Low, Medium, High. It's currently set to Low.
    I did a few web searches, and found an Apple.com article: <http://support.apple.com/kb/HT3789?viewlocale=en_US> which explained how to disable Bonjour Service Advertisements. I believe this is the same thing as 'Multicasting'. The process is a modification of "/System/Library/LaunchDaemons/com.apple.mDNSResponder.plist", and a restart of the Mac is required afterwards.
    I'm a bit concerned that disabling multicasting will interfere with my AppleTVs and iTunes music sharing, but I may try it next time I'm up for a computer workout. This task will require editing of system preference files, could require multiple restarts, might interfere with my AppleTVs, could interfere with my iTunes file sharing, doesn't have a documented relationship to my problem.
    This is way to difficult for something that should just work. Did you say you had read something about a relationship between this bonjour multicasting and smb connectivity? If it was online could you post the link?
    I'm currently able to connect to the drive using NFS, but I have to manually configure that connection each time I reboot (can't get the 'Disk Utility' configured to do it automatically). While it's working with NFS, it's not my preferred connect method (for various reasons).

  • I can't connect to a web site via the site's own WiFi.

    This is a strange one. When I'm in the New York Public Library and connected to the internet via their WiFi I can connect to any web site EXCEPT the New York Public Library's! (www.nypl.org) It tries connecting then times out every time. I can connect to the NYPL's site when I'm not there from home or other WiFis public or private, and when there I can connect to it on my iPhone, but not from my computer with either Firefox or Safari. Other people with Macs can access the site from there and I went over my settings with one of them but could find no differences.
    I'm using 10.5.7 and have the latest updates for Firefox and Safari and the latest updates for OSX. What's frustrating is that when I'm at the library doing research there are databases one can only access from there, not from outside, so it's a very odd situation. Using iPhone for such a reason is quite impractical, too so I'd appreciate any help anyone can offer. I'm sure it's a setting somewhere in my network prefs or something but I'm baffled as to what it might be - has anyone else ever run across something similar?
    Thank you!

    I am hear at the New York Public Library now. I am connected to the internet on their WiFi but still cannot get to their site at the address http://www.nypl.org , it times out. I pinged them with this result:
    Ping has started ...
    ping: cannot resolve http://www.nypl.org: Unknown host
    I tried "lookup" with the following result:
    Lookup has started ...
    ; <<>> DiG 9.4.3-P1 <<>> http://www.nypl.org +multiline +nocomments +nocmd +noquestion +nostats +search
    ;; global options: printcmd
    nypl.org. 182 IN SOA ns1.nypl.org. root.ns1.nypl.org. (
    2002092709 ; serial
    10800 ; refresh (3 hours)
    3600 ; retry (1 hour)
    10800 ; expire (3 hours)
    10800 ; minimum (3 hours)
    I have tried at other times to get to the site through links from other sites with no luck.
    Thank you in advance for your time and attention.

  • Create web service using java class

    Hi,
    I created the web service using java class then i deployed this web service in to the weblogic admin server.when i tested this process it is working fine.
    when I tested The generated WSDL to this process in browser(IE). it is not working.
    I need to to invoke this webservice from another BPEL but this WSDL is not working.

    Hi,
    when i created the webservice in jdeveloper by default it is connected to integrated weblogic server and generates this wsdl.
    http://localhost:7101/helloApplication-javaexcel-context-root/MyWebService1Soap12HttpPort?WSDL
    then I deployed this webservice in to the Adminserver.it gives the following URL.
    http://192.168.56.1:7001/extracExcelToCSV-extractExcelToCSV-context-root/ExtractExcelToCSVSoap12HttpPort?wsdl
    This URL is not working but when i tested this process it is working fine.
    It is giving below error when i try to invoke from jdeveloper
    Error while reading wsdl file
    caused by:java.net.connectExcepption :Connection timed out:connect

  • My Mac will not automatically connect to a web site when I double click

    My Mac will not automatically connect to a web site when I double click.  The Icon blinks but nothing happens.  This happened once before but I don't recall how it was fixed.  I can often (but not always) open the site by using "open with Safari.app(default)

    Firefox 3 will not run on OS X 10.3.9, it requires at least 10.4
    Try one of these browsers to see if you can access Hotmail - [http://www.seamonkey-project.org/releases/seamonkey1.1.19/ SeaMonkey 1.1.19] or [http://caminobrowser.org/download/ Camino 1.6.11]

  • WRT54G2 and WRT54G locks-up (freezes) when blocking web sites using Access Restrictions

    I am convinced that a few Linksys routers such as WRT54G2 and WRT54G have a major issue when blocking web sites using Access Restrictions (Internet Access Policy). After a few hours of internet access by 15 wired users the Linksys locks-up and blocks all internet web access. The only solution is to restart the power on the router.
    We are currently using a Linksys WRT54G2 v1 (firmware 1.0.04). We upgraded the WRT54G2 v1 firmware to the latest 1.0.04 version which did not resolve the issue.  NOTE: We were previosuly using a a Linksys WRT54G v1.1 (firmware 4.21.1) until the power supply blew a week after we started blocking web sites using Access Restrictions (Internet Access Policy).  
    Basically, we have a T1 internet connection and a hub connected to the Linksys router. We are trying to block several web sites such as facebook, myspace, etc. for 15 wired users. We do not use wireless connections.
    This is the 2nd time it happened with 2 different models.
    Please help ASAP.
    Thank you,
    Lance
    (Mod note: Edited post. Some parts off topic.. Thanks!)

    Also,  you have already upgrade/re-flash the firmware of your Linksys Router you need to reset and reconfigure your router from scratch. Press and hold the reset button for 30 seconds...Release the reset button...Unplug the power cable from your router, wait for 30 seconds and re-connect the power cable...Now re-configure your router...

  • Flash player works on https web sites but not on http web sites ?

    Flash player works on https web sites but not on http web sites ?
    I've tryed a lot of things to solve this problem but impossible to find the solution.
    - re-instal flash player
    - disable the firewall (windows)
    - disable the firewall and the antivirus (bitdefender)
    I test my computer on an other internet provider and everything works correctly
    I test an other computer on my internet connection and everything works correctly.
    The problem comes from my computer on my internet connection.
    I'll appreciate a solution.
    Thank you.

    This is what you should see under "plugins" in Opera:
    Make sure Flash Player is listed and enabled.
    It comes from the same place as the plug-in for Firefox, so one won't work if the other doesn't.
    If that doesn't work, try a clean install. http://forums.adobe.com/message/4041846

  • Web site with Java Scripts ( on iphone4)

    try to open a web site with Java scripts , but it just show empty on the scripts section , anyone can help ? (on iphone 4 with iOS 4.1)

    Hi, welcome to Apple Discussions.
    Web pages that make use of Javascript should work just fine. Those that have embedded Java applications won't. Java & Javascript are two different animals despite the similarity in the names. Like Flash, Java is not supported on iOS.
    tt2

  • I am trying to publish a web site using my own domain. How do I transfer my host to mac from another server?

    I am trying to publish a web site using my own domain. How do I transfer my host to mac from another server?

    I've created a CNAME entry to redirect the domain to apple but the site is still not live! Can anyone help please?
    Did you also do what is required in the .Mac account settings?
    http://help.apple.com/mac2/1/help/member/pgs2/memfmsetgen367.html
    Could you provide your urls?

  • How to embed 3D models in web page using JAVA?

    Hello
    I'm doing a project at University to create a virtual tour of a village. I am creating the buildings in MAYA using polygon planes and cubes and then exporting to VRML.
    I plan to embed each individual model into a separate web page. Then when the user clicks on a location in a 2D map they will be taken to the web page containing that building.
    However, I can't work out how to embed these 3D models into web pages using JAVA. Can anyone help me with this, please?
    Also, I've been told to use JAVA 3D to interact with the project but am unclear as to how JAVA 3D would be used in this project - aqny ideas/suggestions welcome!
    M.

    If you use Java-plugin, you can embed Java3D in a web page.
    Here is the URL(http://www.geovista.psu.edu/products/demos/LorenzAttractor3D/index.html) which used Java3D.
    I hope this helps.
    Masa

Maybe you are looking for