4 registered members (ozgur, Ayumi, VHX, monarch),
1,161
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
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
nfs42
Serious User
|
Serious User
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: Arnd]
#166726
11/17/07 11:59
11/17/07 11:59
|
Joined: Apr 2006
Posts: 1,551 Netherlands
D3D
Serious User
|
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.
|
|
|
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
Serious User
|
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; }
|
|
|
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
nfs42
Serious User
|
Serious User
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
|
|
|
|