how to show result of a C function in the server?

Discussion of chess software programming and technical issues.

Moderator: Ras

Uri Blass
Posts: 10903
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

how to show result of a C function in the server?

Post by Uri Blass »

I can use a computer that is connected to the server.
I also can use microsoft visual studio 2008 that is supposed to support C++

I think about building some website in order to let people train about chess.
I thought that some type of exercise may be asking the user to calculate perft(1) when I guess that better players can do it faster.

The idea is that the server is going to give the user some random position from some epd file and ask the user to calculate perft(1) when the user may get rating based on accuracy and based on speed.

I think to use C for the function that calculate perft(1) and for the function that choose random position from epd file.

The problem is that I do not know how to show result of C function on the web server.

I would like to have step by step instructions how to be able to write a code that show result of a simple C function in the server when I use
visual studio2008

Note that visual studio2008 has the option
file->new web site.

I tried to ask in another forum about it and so far did not get replies that helped me.

http://bytes.com/topic/net/answers/8773 ... on-website

Uri
Fguy64
Posts: 814
Joined: Sat May 09, 2009 4:51 pm
Location: Toronto

Re: how to show result of a C function in the server?

Post by Fguy64 »

Just to clarify. You want to create a web based application, a program that will execute within the user's web browser.

There are a couple of ways to approach this sort of thing. You say you want the web server to display the resullt of some c++ code that is executed on the server.?

I am not sure how knowledgable you are about web based programming. My only suggestion at this point is to leave your options open as to the actual role for the server will play. Consider that you don't necessarily have to have code that is executed on the server. You can do this kind of thing easily using java or javascript or some other web based language, and no code is executed on the web server, rather code is downloaded from the server to be executed in the user's web browser.

If it has to be c++, then I'll let someone else advise you. Personally I think java would be more appropriate than c++, but that is based on a limited know2ledge of c++, maybe someone else has a good way to use c++ for this.
Uri Blass
Posts: 10903
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: how to show result of a C function in the server?

Post by Uri Blass »

Fguy64 wrote:Just to clarify. You want to create a web based application, a program that will execute within the user's web browser.

There are a couple of ways to approach this sort of thing. You say you want the web server to display the resullt of some c++ code that is executed on the server.?

I am not sure how knowledgable you are about web based programming. My only suggestion at this point is to leave your options open as to the actual role for the server will play. Consider that you don't necessarily have to have code that is executed on the server. You can do this kind of thing easily using java or javascript or some other web based language, and no code is executed on the web server, rather code is downloaded from the server to be executed in the user's web browser.

If it has to be c++, then I'll let someone else advise you. Personally I think java would be more appropriate than c++, but that is based on a limited know2ledge of c++, maybe someone else has a good way to use c++ for this.
Thanks but
I need c++ or c code
The idea is that the user is going to give some input and the site is going to run the exe of some C program and give an output based on the result.

There are chess sites that do it.
The user give them a game and they give the game to some chess engine that is used to analyze the game and give the user the result of the analysis.

I believe that the chess engine is written in C so they need to call C functions.

Uri
Fguy64
Posts: 814
Joined: Sat May 09, 2009 4:51 pm
Location: Toronto

Re: how to show result of a C function in the server?

Post by Fguy64 »

Uri Blass wrote:
Fguy64 wrote:Just to clarify. You want to create a web based application, a program that will execute within the user's web browser.

There are a couple of ways to approach this sort of thing. You say you want the web server to display the resullt of some c++ code that is executed on the server.?

I am not sure how knowledgable you are about web based programming. My only suggestion at this point is to leave your options open as to the actual role for the server will play. Consider that you don't necessarily have to have code that is executed on the server. You can do this kind of thing easily using java or javascript or some other web based language, and no code is executed on the web server, rather code is downloaded from the server to be executed in the user's web browser.

If it has to be c++, then I'll let someone else advise you. Personally I think java would be more appropriate than c++, but that is based on a limited know2ledge of c++, maybe someone else has a good way to use c++ for this.
Thanks but
I need c++ or c code
The idea is that the user is going to give some input and the site is going to run the exe of some C program and give an output based on the result.

There are chess sites that do it.
The user give them a game and they give the game to some chess engine that is used to analyze the game and give the user the result of the analysis.

I believe that the chess engine is written in C so they need to call C functions.

Uri
OK well if it has to be c++ then so be it. I'm interested in that kind of technology, so I'll make a few enquiries myself, and If I find anything I'll let you know. Good luck.
Fguy64
Posts: 814
Joined: Sat May 09, 2009 4:51 pm
Location: Toronto

Re: how to show result of a C function in the server?

Post by Fguy64 »

you might find an answer here

http://www.micronovae.com/CSP.html
Uri Blass
Posts: 10903
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: how to show result of a C function in the server?

Post by Uri Blass »

Fguy64 wrote:you might find an answer here

http://www.micronovae.com/CSP.html
tried to download
CSP Engine v1.6 for Microsoft C++ Compiler


Unfortunately I get the error
"no supported web server appears to be installed in your sysyem setup cannot continue."

Uri
Gerd Isenberg
Posts: 2251
Joined: Wed Mar 08, 2006 8:47 pm
Location: Hattingen, Germany

Re: how to show result of a C function in the server?

Post by Gerd Isenberg »

Uri Blass wrote:I can use a computer that is connected to the server.
I also can use microsoft visual studio 2008 that is supposed to support C++

I think about building some website in order to let people train about chess.
I thought that some type of exercise may be asking the user to calculate perft(1) when I guess that better players can do it faster.

The idea is that the server is going to give the user some random position from some epd file and ask the user to calculate perft(1) when the user may get rating based on accuracy and based on speed.
I think you need to setup a HTTP based Web server, for instance IIS from ms.
In C++ you may use the System.Web Namespace, like HttpRequest Class.
Uri Blass
Posts: 10903
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: how to show result of a C function in the server?

Post by Uri Blass »

Gerd Isenberg wrote:
Uri Blass wrote:I can use a computer that is connected to the server.
I also can use microsoft visual studio 2008 that is supposed to support C++

I think about building some website in order to let people train about chess.
I thought that some type of exercise may be asking the user to calculate perft(1) when I guess that better players can do it faster.

The idea is that the server is going to give the user some random position from some epd file and ask the user to calculate perft(1) when the user may get rating based on accuracy and based on speed.
I think you need to setup a HTTP based Web server, for instance IIS from ms.
In C++ you may use the System.Web Namespace, like HttpRequest Class.
Thanks but
I am using IIS (internet information server)
The question is if I can use this server to run a code in C.

Uri
Aleks Peshkov
Posts: 947
Joined: Sun Nov 19, 2006 9:16 pm
Location: Russia
Full name: Aleks Peshkov

Re: how to show result of a C function in the server?

Post by Aleks Peshkov »

http://en.wikipedia.org/wiki/Common_Gateway_Interface
In short -- you have to send all HTTP transaction data manually to stdin and get response from stdout streams (like UCI or Winboard).

Simpler way is to you use some Web-language like PHP to hide all gory HTTP details and call an external program from PHP-script. I never searched the subject, but I think there should be some existing scripts that do that work.
http://www.php.net/manual/en/function.shell-exec.php
Gerd Isenberg
Posts: 2251
Joined: Wed Mar 08, 2006 8:47 pm
Location: Hattingen, Germany

Re: how to show result of a C function in the server?

Post by Gerd Isenberg »

Uri Blass wrote: Thanks but
I am using IIS (internet information server)
The question is if I can use this server to run a code in C.
Yes, all .net languages including managed C++.