?
Solved

server-client concept

Posted on 1997-04-05
1
Medium Priority
?
256 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 100 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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month14 days, 12 hours left to enroll

771 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