Results 1 to 6 of 6
  1. #1
    Edebarudo is offline Member
    Join Date
    May 2010
    Posts
    4
    Rep Power
    0

    Talking How to save highscores on a file on a server?

    Hi! I'm a newcomer to this forum and not yet so experienced in Java programming.

    I'm developing a Java applet with a Memory-alike game.
    When the player finishes the game it should store the score on a file on the server if it's good enough.

    The problem I have is when I am trying to save the score on the server. I'm trying to follow this websites instructions:
    Instructions
    , but I'm not sure I understand the basic concepts of a cgi-script.

    If anyone has done this before, you could perhaps explain to me how this works.
    Can I just send data to the cgi-script on the server, and the script will receive it and save the data to the file?
    Must I make the cgi-script runnable? And then how when I'm in windows?

    This is the cgi-script I have:

    open(OUT, "> ../save/filename.highscore");
    print "content-type: text/plain\n\n";

    while (<>) {
    print OUT $_;
    print $_;
    }
    close (OUT);
    exit 0;
    If you want me to post the java code, please tell me what you want me to post, and I will do it.

    Thank you for all your help in beforehand!
    // Edebarudo from Sweden

  2. #2
    Edebarudo is offline Member
    Join Date
    May 2010
    Posts
    4
    Rep Power
    0

    Default Thank you!

    Well, thank you for your major help!
    Now I will become even better at programming in java since you just helped me to understand what I did wrong.

    Praise the lord, you saved my day. :confused:

    Seriously, if you don't want to help... Well, just don't comment. Since it frankly makes me sad that there are people out there just roaming around the Internet, trying to feel supreme.

  3. #3
    Webuser is offline Senior Member
    Join Date
    Dec 2008
    Posts
    526
    Rep Power
    0

    Smile

    Oh, wellcome

    I think you should better change you cgi for servlet or jsp :) It is more Java-like
    I recommend a bound like a
    applet <-> servlet <-> server HDD

    So you don't need to use the cgi-script because you can simply develope a servlet to save your score :)

  4. #4
    Edebarudo is offline Member
    Join Date
    May 2010
    Posts
    4
    Rep Power
    0

    Default Thanks

    Thanks for the reply! :D

    I will definitely try with the servlet thing!

    One question though... Isn't servlets server-side java programs that has to be running all the time on the servers?

  5. #5
    Webuser is offline Senior Member
    Join Date
    Dec 2008
    Posts
    526
    Rep Power
    0

    Default

    You have to download a web server like a Tomcat to make your servlets work...
    If my answer helped you. Please click my "REP" button and add a comment
    Have a Good Java Coding :)

  6. #6
    Edebarudo is offline Member
    Join Date
    May 2010
    Posts
    4
    Rep Power
    0

    Default Thanks

    Thanks so much for all the help!

    I've gotten the game to run on the server now, with images, sounds and in a jar-file.

    I didn't use a servlet though, instead I used a php-script on the server to save the highscores.

    Anyways, thanks for the help! ;)

Similar Threads

  1. save file based on file extension
    By masa in forum AWT / Swing
    Replies: 4
    Last Post: 05-11-2010, 12:17 PM
  2. Replies: 0
    Last Post: 03-05-2010, 05:21 AM
  3. Highscores program help! please!
    By miker100 in forum New To Java
    Replies: 1
    Last Post: 01-21-2009, 12:26 AM
  4. Save a jpg image on server
    By yadavjpr in forum Java Servlet
    Replies: 1
    Last Post: 11-21-2008, 02:49 PM
  5. Replies: 13
    Last Post: 04-28-2008, 10:57 AM

Tags for this Thread

Posting Permissions

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