Solved

server-client concept

Posted on 1997-04-05
1
254 Views
Last Modified: 2011-10-03
Hi

  Ina Gardner gave me this adress where I could ask   my questions. Well,
  let's say that although I've read 1 1/2 Java books and a    bit of JavaScript I'm still fustrated since I've not get    some important concepts. I don't know if you know were I    could find a general text that can answer to my questions   rather than the usual chapters in
  books that explain the Security Manager restrictions or   so...

  In 'Developing Professional Java Applets', page 124 they   gives this:

    myFile=new File("File.txt");
    ......
    ...
    File myDirectory=new File("...\\...");
    ...
    ...

  There's no URL specified in any operation related to such   classes in
  this chapter. In a chapter about socket, one could find   things like:
  outbound.writeBytes("GET /HTTP/1.0\r\n\r\n");

  Before I start to code extensivelly and buid a website, I   want to be
  sure if I have correctly some basical concepts:

 a)If I'm dealing with a provider (let's say my one ,VIR    communications)
   than there's no way to use classical databases in an       application. If my computer is shut down, a remote PC can
   access this site as long
   as a VIR server is available, but it is no longer my PC
   business once the applets are upload to this space       reserved on VIR server, right? So a database on my Hard    Drive is useless for my application
   normally except if I have enough space on a URL adress to    upload it in advance with FTP, right?  There's a couple     of examples with images in my book, but I'm not sure if     the princip can be really the same for databases like
   Oracle or so. I suppose that they have always an image
   of what you upload on their disk, no?

 b) I've not yet my website but it'll come soon.I think the     usual pattern is this one: the provider has a HTML wich
   is calling an applet that run  permanently ( the server).
   When someone access my URL and HTML scrip MY applet is    transfered to client's machine before to be interpreted.
   But since it is executed on client's machine, no data    
   can be write on my URL, they can just be read, right?    
   I've an example of a server applet in my book, but I    
   don't know how this one could run on a permanent base on    the server side (if I want to perform database operations    or so). How could I do if I want my own server applet to    run constently and respond rather than my provider's   applet???

  Thanks in advance

0
Comment
Question by:jfbe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 1

Accepted Solution

by:
fadl earned 50 total points
ID: 1219425
Hello,

>there's no URL specified in any operation related
>to such classes in  chapter.
>In a chapter about socket, one could find things like:
>outbound.writeBytes("GET /HTTP/1.0\r\n\r\n");

In general Java is a full featured programming language as
C, C++, Smalltalk, Perl , Basic or whatever else are.
It must be precompiled and then it is interpreted by Java
virtual machine (JVM). [[You sure can omit precompiling by
replacing default ClassLoader by your own one that
run precompiler in suitable moments automatically. ]]

>Before I start to code extensivelly and buid a website,
>I want to be sure if I have correctly some basical concepts:

The package hierarchy is usually mapped into directory tree
on the one's disk. Java program is launched by starting
JVM while giving it name of some class and some command line
params. This class must
implement public static void main(String argv[]){} method
to get program started. Until this time it is much similar
to the good old  void main(char*....) in C {:)
Such a Java program can do anything with Files, Sockets, AWT
etc - no restrictions.

Another way to start up Java code is to make it as an Applet.
Your applet must subclass java.applet.Applet and instead
of static main() method in the previous case init() [[and some
other methods]] method will be called on automatically created instance of
your applet each time your applet is to be showed on someone's
page. You can make your applet to implement Runnable interface
and to start arbitrary computation with many threads with
several restrictions. You have no access to local files and
all you can do beeing applet is to connect using sockets
to URL you were downloaded from (== browsed).
These are general principles and it implies what can be done
with applets and what can not.

>a)If I'm dealing with a provider (let's say my one ,VIR
>communications)
>than there's no way to use classical databases in an
>application.
>If my computer is shut down, a remote PC can
> access this site as long
>as a VIR server is available, but it is no longer my PC
> business once the applets are upload to this space reserved on
> VIR server, right?
.. yes

 So a database on my Hard Drive is useless > >for my application   normally except if I have enough space on a >URL adress to upload it in advance with FTP, right? There's a
... exactly

>couple of examples with images in my book, but I'm not sure if >the princip can be really the same for databases like
>Oracle or so. I suppose that they have always an image
>of what you upload on their disk, no?
... I don't understand exactly

>b) I've not yet my website but it'll come soon.I think the usual
>  pattern is this one: the provider has a HTML wich
> is calling an applet that run permanently ( the server).
... You can have any number of various applets that
in their body connect via Socket to your database running
on WWW server or to your own Java server listening on some
socket running as a daemon {:) etc etc...

> When someone access my URL and HTML scrip MY applet is
>  transfered to client's machine before to be interpreted.
> But since it is executed on client's machine, no data
>  can be write on my URL, they can just be read, right?
... According to general rules you can only conect to your
mother WWW server via Socket. You can read/write data there.

> I've an example of a server applet in my book, but I
> don't know how this one could run on a permanent base on the
> server side (if I want to perform database operations or so).
 Just a sort of deamon running continuously... Written in Java
sure {:)

>How could I do if I want my own server applet to run constently >and  respond rather than my provider's applet???
... Applets are not designed for such kind of things, see
documention of java.applet.Applet -> start() stop() destroy()
methods.


0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
Suggested Courses

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question