Results 1 to 14 of 14

Thread: Simple Question

  1. #1
    barusk is offline Member
    Join Date
    Feb 2009
    Posts
    40
    Rep Power
    0

    Default Simple Question

    can a "signed" applet create a socket to a machine that is not the host from which the applet was downloaded from. or i this a general rule for all applets. unsigned or signed.

  2. #2
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    I'm not sure, I'll let others chime in.

    I thought that the sandbox allowed only access to the same host that the applet came from. But I could be wrong.

    Can I ask:

    Why are you thinking of using an applet? They stopped being popular a decade ago, mostly due to poor browser support. While I'm sure the support is better, I can't imagine using an applet these days.

  3. #3
    barusk is offline Member
    Join Date
    Feb 2009
    Posts
    40
    Rep Power
    0

    Default

    so do you think a web application would be better. i am relatively new to java. not sure how i would accomplish the samething with a web application. i'm using netbeans by the way. thank you for for your info though.

  4. #4
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    You have a couple of options. You can use a Web application, and have the server side code do whatever network communications you need done. In general, asking a browser to do network communications to a host other than the Web server violates the spirit of browser security, if not the letter of the law.

    The other option is to use JNLP, Java Network Loadable Programs (or something like that). It allows a link to download a specially package Java program to the client. The client's user generally has to authorize the download. JNLP will then cache the application on the client machine and run it. The client can then run the application without a new download. If the application is updated, JNLP will notice and offer to download the new version.

    This is essentially new technology, but it is an old concept. The Java program can do anything once it is downloaded. I assume there is a signing mechanism that does along with JNLP. Sun's Java Tutorials use it all over the place to allow you to download sample applications.

    As you can tell, I think this is a great concept, if you have a trust relationship with your users.

  5. #5
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    Quote Originally Posted by barusk View Post
    so do you think a web application would be better. i am relatively new to java..... i'm using netbeans by the way.
    The only part of being new to java that is important is that when you have only a hammer, all problems look like nails.

    What are your requirements? What are you trying to do?

    Web application talking to browsers is how the 'net has worked for this entire century. (sure, its only 9 years old).

    Netbeans can help you write web applications, I've been using it to do that for more than five years.

  6. #6
    barusk is offline Member
    Join Date
    Feb 2009
    Posts
    40
    Rep Power
    0

    Default

    the reason i need to make a connection to another machine is that the other machine is a small board with a wifi unit and all im using this program for is to program my own small lighting machines. the program so far simply tells the light to come on or turn off i also have a scrollbar which controls the intensity of the light. now it works very well from my own machine even thru a browser using a jnlp. but when the client downloads the app using the web server i have it simply wont connect to the wifi unit. it all seems very simple and that im missing something very simple. keep in mind the my machine is the only machine connect to wifi unit using a dlink wireless connection.

  7. #7
    barusk is offline Member
    Join Date
    Feb 2009
    Posts
    40
    Rep Power
    0

    Default

    this is pretty much my training for the company i am working for now. after i accomplish this i will continue on and adding things to my app to eventually control every aspect of any lighting system that my company designs.

  8. #8
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    OK, I think I'm getting the picture.

    First, I don't think JNLP runs in the browser; the browser is just a vehicle to download the application to a client. In many ways this, is a superior paradigm, since you don't have to deal with browser issues.

    Here is where I think you might be running into a problem. There is a firewall between the D-Link and your clients. The clients can reach the Web server because there is a tunnel through the firewall.

    I strongly suggest you do *not* create a tunnel to the lighting device. That is asking for trouble. In addition, as you add many of these lighting devices, you will not want clients to have the ability to access each of them directly.

    What you have done so far is to create a working prototype, which is good. Now, you need to create a second prototype, which is a system that will allow external clients to interact with lighting devices in a secure way.

    From a security and an ease of implementation perspective, a Web service is best. A Web server gives you pre-built security and the ability to handle multiple clients. Web services give you the ability to support almost any kind of client, including your JNLP Swing application.

    In the Web server, you can create an application that keeps track of every lighting device. This application will have the ability to query each device for its current settings and to send instructions to the device. Using a single application will allow you to control access when multiple clients attempt to change the settings of a single device at the same time. The Web services will talk to this application.

  9. #9
    barusk is offline Member
    Join Date
    Feb 2009
    Posts
    40
    Rep Power
    0

    Default

    i have disabled my firewall altogether and i already have a web server set up using sun ONE webserver. Your sayin i need to create a second app and add that to my server also?

  10. #10
    barusk is offline Member
    Join Date
    Feb 2009
    Posts
    40
    Rep Power
    0

    Default

    for some more info my web server runs on the ip range for which my internet connection comes from, the only thing i have a dlink for is so that my machine can talk to the wifi. the dlink has nothing to do with my internet connection. it has a completely different IP if that helps at all.

  11. #11
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    7

    Default

    Well, that would present a problem. The only thing better than a firewall is to have an IP address that is unreachable.

    Get the proverbial "pencil and paper" and draw a picture of the Internet, your Web server, and your D-Link. Do *not* connect anything with lines unless they are

    1. In the same subnet
    2. Connected by a router

    From what you described, your Web server is using an Internet address, and your D-Link is using a private address. No line between them. I don't know how your PC fits into this picture; possibly, it has two addresses.

    As far as adding another application: I'm talking about building whole systems.

    Draw another picture of what you want this thing to look like when it is all done. Lots of lighting devices, lots of clients on the Internet. That's a lot of lines, and you *don't* want the lighting devices touching the Internet.

  12. #12
    barusk is offline Member
    Join Date
    Feb 2009
    Posts
    40
    Rep Power
    0

    Default

    here goes. I have a lan connection which my IP is served to me thru and airport extreme from another machine. my web server runs on the IP served to me by the airport extreme which is a 10.0.x.x IP. The wifi is connected to my machine using a dlink dwl g122. the wifi has its own static ip which is a 169.254.x.x IP which the dlink connects to without a problem. My app uses a socket(169.254.x.x, port#).The app sends packets which the board w/wifi understands thru the dlink, and right now all i have is two lights. which is all i need until i get this working the way i want it.

  13. #13
    barusk is offline Member
    Join Date
    Feb 2009
    Posts
    40
    Rep Power
    0

    Default

    keep in mind i am connected to airport extreme not using the dlink but using a ethernet cord.

  14. #14
    barusk is offline Member
    Join Date
    Feb 2009
    Posts
    40
    Rep Power
    0

Similar Threads

  1. A simple List question
    By right2001 in forum New To Java
    Replies: 2
    Last Post: 02-16-2009, 03:37 AM
  2. Super simple question
    By jigglywiggly in forum New To Java
    Replies: 3
    Last Post: 01-26-2009, 01:17 AM
  3. Simple question about access
    By tortelini in forum New To Java
    Replies: 6
    Last Post: 09-06-2008, 05:41 PM
  4. Simple Method Question
    By Froz3n777 in forum New To Java
    Replies: 2
    Last Post: 02-13-2008, 02:39 AM
  5. Probably a really simple question...
    By ibanez270dx in forum New To Java
    Replies: 0
    Last Post: 11-16-2007, 01:27 AM

Posting Permissions

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