Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
6 registered members (AndrewAMD, Ayumi, degenerate_762, 7th_zorro, VoroneTZ, HoopyDerFrood), 1,268 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19053 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
GSTNet and C-Lite #166723
11/09/07 21:31
11/09/07 21:31
Joined: Sep 2007
Posts: 23
Dietzenbach
Arnd Offline OP
Newbie
Arnd  Offline OP
Newbie

Joined: Sep 2007
Posts: 23
Dietzenbach
Hallo,

i tried to load an HTML Page with GSTNet Helper Function "GSTNet_HTTPGet".
With the C-Script File (GSTNET.wdl) it is working very succesfull -
but i tried to change it into C-Lite; i have changed the dll functions in
the "GSTNet.wdl" Script to an kind of "GSTNet.c" to get an dll Call.
But until now are still some problems with the Char Variables wich i got back.

Has somebody running C-Lite with GSTnet ? Can give me some hints?

Thanks in advance.

Re: GSTNet and C-Lite [Re: Arnd] #166724
11/09/07 22:19
11/09/07 22:19
Joined: Jun 2001
Posts: 1,004
Dossenbach
N
nfs42 Offline
Serious User
nfs42  Offline
Serious User
N

Joined: Jun 2001
Posts: 1,004
Dossenbach
here's my suggestion, not tested

GSTNet.c
function GSTNet_HTTPGet(STRING* sHostname,STRING* sPath,STRING* sResult); // returns a requested page
STRING* sGSTNet_HTTPResult[100000]; // allocate memory for results


call this way:

GSTNet_HTTPGet("www.gstools.de","/index.php",sGSTNet_HTTPResult);


Andreas
GSTools - Home of
GSTScript 0.9.8: lua scripting for A6/7/8
GSTNet 0.7.9.20: network plugin for A6/7/8
GSTsqlite 1.3.7: sql database plugin for A6/7/8
3DGS Codebase: 57 snippets || 3DGS Downloads: 248 files
Re: GSTNet and C-Lite [Re: nfs42] #166725
11/17/07 11:00
11/17/07 11:00
Joined: Sep 2007
Posts: 23
Dietzenbach
Arnd Offline OP
Newbie
Arnd  Offline OP
Newbie

Joined: Sep 2007
Posts: 23
Dietzenbach
sorry its not working...

It seems that it is not possible to use Dlls which are working in WDL very correctly, not working anymore in Lite-C without changes...

Re: GSTNet and C-Lite [Re: Arnd] #166726
11/17/07 11:59
11/17/07 11:59
Joined: Apr 2006
Posts: 1,551
Netherlands
D3D Offline
Serious User
D3D  Offline
Serious User

Joined: Apr 2006
Posts: 1,551
Netherlands
Because in GSTNet with C-Script it goes like:
Code:
dllfunction GSTNet_effect(functionname, number, &position, &speed);



And in Lite-C something like:
Code:
function GSTNet_effect(functionname, var* number, var* position, var* speed);



I'm not really expert, but I think all these DLL functions must be adapted to Lite-C in order to prevent serious errors. Also it could be that the GTSNet DLL source code must be changed. I remember such problems while converting Destops MySQL DLL for Lite-C and Uhrwerk/Zeitwerk helped me fixing.


smile
Re: GSTNet and C-Lite [Re: D3D] #166727
11/20/07 17:00
11/20/07 17:00
Joined: Sep 2007
Posts: 23
Dietzenbach
Arnd Offline OP
Newbie
Arnd  Offline OP
Newbie

Joined: Sep 2007
Posts: 23
Dietzenbach
Hallo D3D,

Yes your MySql DLL is working very fine with Lite-C an external MySQL Server - I have testet it.
But i need an normal Http Request and i think that is not possible with your DLL without Changes. (Leider...)

Re: GSTNet and C-Lite [Re: Arnd] #166728
11/20/07 17:18
11/20/07 17:18
Joined: Apr 2006
Posts: 1,551
Netherlands
D3D Offline
Serious User
D3D  Offline
Serious User

Joined: Apr 2006
Posts: 1,551
Netherlands
Sorry I think you misunderstood. I meant to say that there are some changes to be made in the script and perhaps GSTNet source as well, if you want to use GSTNet with Lite-C. I remembered this from when I was working on Destop's MySQL plugin. Didn't meant you can use the MySQL dll for your quest.

Anyways i've tried GSTNet now. Only I found the GSTNet_HTTPGet function a little confusing. Because sResult is a var and string? Maybe nfs42 can explain?

test.wdl Code:
PLUGINDIR = ".";
BIND "GSTNet.dll";


test.c Code:
#include <acknex.h>

var sResult;

STRING* sGSTNet_HTTPResult[100000]; // allocate memory for results
STRING* sHostname;
STRING* sPath;

//------------------------------------------------------------------
// helper functions
//------------------------------------------------------------------
function GSTNet_HTTPGet(STRING* sHostname, STRING* sPath, STRING* sResult); // returns a requested page
function GSTNet_HTTPBusy(); // returns != 0 if a httprequest is busy

function http()
{
//var sResult;
sResult = str_create("#100000");
GSTNet_HTTPGet("www.nixip.com","/index.php",sResult);

while(GSTNet_HTTPBusy()){wait(1);}
diag(sResult);
str_remove(sResult);
}

//------------------------------------------------------------------
// test panel
//------------------------------------------------------------------
PANEL* GSTNet_panel =
{
digits(25,25,4,*,1,sResult);
flags = VISIBLE;
}

function main()
{
level_load("");
wait(1);
on_h=http;
}




smile
Re: GSTNet and C-Lite [Re: D3D] #166729
11/20/07 20:56
11/20/07 20:56
Joined: Jun 2001
Posts: 1,004
Dossenbach
N
nfs42 Offline
Serious User
nfs42  Offline
Serious User
N

Joined: Jun 2001
Posts: 1,004
Dossenbach
Hi,
this is from the manual:

GSTNet_HTTPGet(sHostname,sPath,sResult)

Description: client+server: sends a http get request port 80
Parameter:
STRING* sHostname the server address: i.e. "www.gstools.de"
STRING* sPath path to the requested file
STRING* sResult returns body of the requested path

Returns none

Remarks
this function is non-blocking, be sure there is no other request running via GSTNet_HTTPBusy()

sResult must be big enough to hold the data otherwise data is truncated and is available as soon as GSTNet_HTTPBusy() returns 0;

don't use str_create with a var, i got only problems.
c (string) handling is one of the plus points of lite-c.
so i think i'll upgrade before next year.


Andreas
GSTools - Home of
GSTScript 0.9.8: lua scripting for A6/7/8
GSTNet 0.7.9.20: network plugin for A6/7/8
GSTsqlite 1.3.7: sql database plugin for A6/7/8
3DGS Codebase: 57 snippets || 3DGS Downloads: 248 files
Re: GSTNet and C-Lite [Re: nfs42] #166730
11/20/07 22:45
11/20/07 22:45
Joined: Apr 2006
Posts: 1,551
Netherlands
D3D Offline
Serious User
D3D  Offline
Serious User

Joined: Apr 2006
Posts: 1,551
Netherlands
Well this seems to work. Although i'm not sure if it's the correct way?

Quote:

HTTPGet:CallbackGET /index.php HTTP/1.0
Host: www.gstools.de
Connection: close

HTTPRequest:Received 256 bytes
HTTPRequest:Received 512 bytes
HTTPRequest:Received 768 bytes...
Normal exit




Code:
#include <acknex.h>

STRING* sHostname;
STRING* sPath;
STRING* sResult;
STRING* sTempHost = "Waiting.. Press 'H' key!";

//------------------------------------------------------------------
// helper functions
//------------------------------------------------------------------
function GSTNet_HTTPGet(STRING* sHostname, STRING* sPath, STRING* sResult); // returns a requested page
function GSTNet_HTTPBusy(); // returns != 0 if a http request is busy

function http()
{
sHostname = str_create("www.gstools.de");
sPath = str_create("/index.php");
sResult = str_create("#100000");

GSTNet_HTTPGet(sHostname,sPath,sResult);
while(GSTNet_HTTPBusy()){wait(1);}

str_cpy(sTempHost," ");
str_cpy(sTempHost,sHostname);

diag(sResult);
str_remove(sResult);

}

TEXT* GSTNet_debugtxt =
{
layer=1;
pos_x = 10;
pos_y = 10;
string = ("Hostname:", sTempHost);
flags=VISIBLE;
}

function main()
{
level_load("");
wait(1);
on_h=http;
}




smile
Re: GSTNet and C-Lite [Re: D3D] #166731
11/22/07 00:35
11/22/07 00:35
Joined: Sep 2007
Posts: 23
Dietzenbach
Arnd Offline OP
Newbie
Arnd  Offline OP
Newbie

Joined: Sep 2007
Posts: 23
Dietzenbach
Hallo D3D,

much thanx for Help - it works now very well!

Arnd


Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1