Re: Applet Consideration

From: Yamin (absdfsd_at_sdfdasfsd.com)
Date: 03/17/04


Date: Tue, 16 Mar 2004 18:27:33 -0500

Okie guys,

Having just went through the learning experience of sorts...this is what I
did.

I have essentially 2 application
1. Applet
2. Server

Applet (Client)
Has all the GUI code and what not. As I said, it was suprisingly easy to
convert my standard application to an applet. I then created clientstubs
for any database access application
i.e. boolean login(String domain, String user, String pass)

I used a really cheap protocol, as the data being sent is just Strings and
some ints.
Basically, everything is sent as String. One String per line so functions
like readline() can work nicely.

*************************************
Client request consists of:
Command String (i.e. "LOGIN" )
param1 String
...
paramn String

Server replies consist of
result string( i.e "PASS" or "FAIL" )
return1 String
....
return paramn String
*************************************

I made it so the client has absolutely no knowledge that the db exists.
Otherwise, I'd have to grant access to the client to hold locks and what
not, which I did not want to give for security reasons. To the client,
everything looks like a function call (w/th some remote method type stuff)

Server (runs on the same machine as the webserver/database...)
The server listens on a port and starts server threads for each new
connection. Each thread must be initialized by a login. This login open a
connection to the database. I did it this way, so in case a thread goes
broke or someting, any locks on tables, transaction will behave nicely and
the user can't preform any operations without login in correctly first.
*************************************

Things I might have done differently:

1. I really wanted to use SSL to encrpypt the connection. This way, login
passwords and other data could be transferred nicely. I read through the
docs samples and what not, but just decided against it as I didn't want to
add any more things that I really didn't understand.

And it seems to work quite well. I tested it both locally and remotely. It
all seems nice ;) Sure, it might have been nice to learn PHP and what not
(it got really tempting last night), but I already did a lot of work on this
in Java, so such is such.

Yamin



Relevant Pages

  • Each client gets the same port number
    ... This class creates a server socket that will ... For each new connection request from client ... */ private String calculate{String result = null; ...
    (comp.lang.java.help)
  • Re: pygame and socket.recv
    ... player, and for the communication, I am sending a pickle string across ... The client sends a dictionary to the server. ... time.sleep to keep the frame rate at 40 frames per second. ...
    (comp.lang.python)
  • Re: Applet Consideration
    ... > the client applet to connect to the server. ... everything is sent as String. ... >> I made it so the client has absolutely no knowledge that the db exists. ... Each thread must be initialized by a login. ...
    (comp.lang.java.databases)
  • Re: Applet Consideration
    ... the client applet to connect to the server. ... My computer(the server) is behind a router ... > i.e. boolean login(String domain, String user, String pass) ...
    (comp.lang.java.databases)
  • Re: Still Need desperate help to start with ASP NET - simplified problems - HELP!!
    ... Not to IIS. ... A client uses IE to talk with a server. ... String) As String ...
    (microsoft.public.dotnet.framework.aspnet)