Solved

server-client concept

Posted on 1997-04-05
1
246 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
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

757 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now