Message Board
Message Board > Fenix / Bennu / Gemix / DIV > [DLL] Network.DLL |
October 18, 2006, 00:19 | |
Sandman
F3n!x0r 1194 posts |
Sorry for my late reply, I had not noticed your post. I don't mind you including Network.dll v1.17a, with some credits somewhere, but I assume you use all CVS stuff so it won't help much. The v1.15 one is not the complete DLL and has some glitches unfixed. It gives a wrong image of Network.dll, so for now please wait until I recoded to v1.17a, which could take some time, because of the competition, although I thought of some tweaks here and there, so I might recode sooner (don't count on it). ____________ BennuWiki Yes, my avatar has grey borders in IE (so get a decent browser) ROOFLEZ ROOFLEZ |
# |
December 14, 2006, 10:21 | |
Quiest
now with more happynes 142 posts |
If got a problem with the newest version, I simply can`t compile (not even the example prg) It just brings up a 'The libraray is not Fenix compatible ("network.dll")' message. Any ideas? Using FXC 0.84 (Mar 30 2004 21:00:31). ____________ Roundhousekick to the face, baby! |
# |
December 14, 2006, 13:47 | |
Sandman
F3n!x0r 1194 posts |
Most probably you are not using 0.84a. Later version are not yet supported: 0.84b crashes when function is used and yours (CVS?) can't compile.
____________ BennuWiki Yes, my avatar has grey borders in IE (so get a decent browser) ROOFLEZ ROOFLEZ |
# |
December 15, 2006, 13:39 | |
Quiest
now with more happynes 142 posts |
Okay thanks, I really was using the CVS, now it works.
____________ Roundhousekick to the face, baby! |
# |
December 15, 2006, 17:08 | |
Sandman
F3n!x0r 1194 posts |
Do you mean it works with the CVS or are you using v0.84a now?
____________ BennuWiki Yes, my avatar has grey borders in IE (so get a decent browser) ROOFLEZ ROOFLEZ |
# |
December 15, 2006, 22:09 | |
Eckolin
Quite Whiskered 388 posts |
The latter, obviously.
____________ Maker of Games... Wisdom is supreme; therefore get wisdom. Need help with coding? I probably wrote something similar. |
# |
December 16, 2006, 02:47 | |
Sandman
F3n!x0r 1194 posts |
I'm so sorry Eckolin. Luckily I have your skilled perception to aid me in dark times.
____________ BennuWiki Yes, my avatar has grey borders in IE (so get a decent browser) ROOFLEZ ROOFLEZ |
# |
December 17, 2006, 14:42 | |
Quiest
now with more happynes 142 posts |
Using 0.84a now
____________ Roundhousekick to the face, baby! |
# |
January 9, 2007, 01:52 | |
Sandman
F3n!x0r 1194 posts |
Peoples peoples! After some nights of hard work, I came up with this: Network.DLL v1.51 Network.DLL v1.51 Tester Yes, I recoded. Damn you, virus, for making me format and losing the code. Anyway enjoy. There are some changes, so you'd have to adjust a few lines in your code. And Fenixpack guys: I'll send you the code of v1.52 in a few days, as I know here and there I must add some code, still. v1.51: Working. Celebrate! The most significant changes are the removal of the internal connections, the removal of NET_Send2() and NET_SendRN2() and the simplification of NET_Init(). Internally many things have changed, mostly for more efficiency. v1.50: Added/Fixed/Changed a lot of things, after half a year, in order to achieve working status again (I lost the sourcecode of v1.15 and up, due to a format). Some things might still not be completely in working order, but that will be sorted out as well in the future. ____________ BennuWiki Yes, my avatar has grey borders in IE (so get a decent browser) ROOFLEZ ROOFLEZ |
# |
January 9, 2007, 16:09 | |
Dennis
どこかにいる 2092 posts |
WELL DONE MR SANDMAN!
____________ Kwakkel |
# |
January 12, 2007, 18:19 | |
natalia
Beardless 1 posts |
please tester is incomplete..! i need a real sample. and DLL source code not is available.. Linux User thanks.. [Edited on January 12, 2007 by natalia] ____________ |
# |
January 17, 2007, 01:01 | |
Sandman
F3n!x0r 1194 posts |
Okay: Network.DLL v1.52 Network.DLL v1.52 Tester I have added the sourcecode for the poor guys not using Windows and/or v0.84a. What is incomplete about the tester? I did not include all the sourcecode, because that would mean a lot of code of other systems, not relating to Network.DLL. v1.52: Added comments, tidied up the code a little. Added and changed some console messages. Added the possibility of removing seperators. Added NET_DisconnectAll() and its synonym NET_CloseAll(). Added NET_IntVersion(). ____________ BennuWiki Yes, my avatar has grey borders in IE (so get a decent browser) ROOFLEZ ROOFLEZ |
# |
January 17, 2007, 11:05 | |
g105b
None 86 posts |
ooooh, sexy
____________ .g105b'' |
# |
February 12, 2007, 05:10 | |
Sandman
F3n!x0r 1194 posts |
Network.DLL v1.53 Network.DLL v1.53 Tester Added sending/receiving of graphs and files. On another note: I've been working on this dll for quite some time now, but a real stresstest has yet to emerge. Does someone think he could build something like that? That would be awesome. It could even be included in the regular ZIP files and of course credits go to the maker. v1.53: Changed the about text in NET_About(). Changed some error codes, as they differed from the same, defined elsewhere. Added NET_SendGraph(), NET_RecvGraph(), NET_SendFile() and NET_RecvFile(). Added the optional parameter includeseperator to NET_Send(). When it is not 0, the connection's seperator will be added at the end of the to be sent data. When it is 0, it won't. Made messages unlimited. because in v1.5x this was more easy. NET_RECV() still has a limit of NET_MAX_MSG_LEN, but this is not a low number, so all should be well. If it's required, it is still possible to make that one unlimited as well. Added NET_ERROR_NULLPOINTER. Added NET_ERROR_NONEXISTINGGRAPH Added NET_ERROR_NONEXISTINGFILE Added NET_ERROR_CREATINGGRAPH Added NET_ERROR_OPENINGFILE Added NET_IntToIP() and NET_IPToInt(),which were previously made in Fenix Added errormessages for the new errorcodes in NET_GetError(). Added NET_SeperatorLength(); Fixed if other peer closes, this side does not notice until it tries to send a message. Moved the parameter includeseperator from NET_Seperator() to NET_Recv() and NET_RecvVar(). ____________ BennuWiki Yes, my avatar has grey borders in IE (so get a decent browser) ROOFLEZ ROOFLEZ |
# |
February 13, 2007, 21:00 | |
yonni
None 420 posts |
How could I go about making a fenix app based on this communicating with a php file on a webserver somewhere?
____________ |
# |
February 14, 2007, 02:28 | |
Sandman
F3n!x0r 1194 posts |
Code: NET_Init(0,1,0); // initialize Network.dll with one connection netid=NET_Open(SERVER_IP,SERVER_PORT); // port 80? (netid = 0) LOOP Switch(NET.Incoming[netid]) case NET_STATUS_DISCONNECTED: // handle the disconnect end case NET_STATUS_ACTIVE: // handle the incoming message while( (msg=NET_Recv(netid))!="") parse(msg); end end case NET_STATUS_INACTIVE: end case NET_STATUS_ESTABLISHED: // handle the establishment NET_Seperator(netid,SEPERATOR_USED,LENGTHOFTHATSEPERATOR); // I don't know the seperator used in HTTP, probably \r\n (=chr(13)+chr(10)) end End frame; END int parse(string input) begin // handle the input end ------------ // send stuff with: NET_Send(netid,msg,true); // or: NET_SendVar(netid,arraypointer,arraysize,true); // the TRUE will tell Network.dll to include the specified seperator at the end of the message This code is very standard for Network.dll, because the parsing of messages and sending of the correct messages is not up to this DLL. That's up to the user of the DLL, who in this case must use the protocol of HTTP and maybe even more. The DLL merely provides a way of communication/transport. I don't know too much about PHP or HTTP, so I suggest you look up the HTTP protocol. But perhaps there is someone here who does know how to do something like this and is willing to share his knowledge with us. ____________ BennuWiki Yes, my avatar has grey borders in IE (so get a decent browser) ROOFLEZ ROOFLEZ |
# |
February 14, 2007, 11:23 | |
yonni
None 420 posts |
The problem I was getting was with the NET_Open or NET_Connect command. It always returned the "Could not resolve host" error.
____________ |
# |
February 14, 2007, 12:37 | |
Sandman
F3n!x0r 1194 posts |
That means you're not specifying the proper server address. Could you give me more information about how you try to open a connection?
____________ BennuWiki Yes, my avatar has grey borders in IE (so get a decent browser) ROOFLEZ ROOFLEZ |
# |
February 14, 2007, 12:48 | |
yonni
None 420 posts |
Code: handle = NET_Open("http://yonni.freehostia.com/stickmenwars/index.php",80); if(handle > -1) add_to_autoconsole("Connected to server",rgb(77,210,43)); else add_to_autoconsole("ERROR connecting to server: "+NET_GetError(handle),rgb(255,0,0)); end EDIT: found the ip of the server using this site and it all works fine now, thanks for your help. [Edited on February 14, 2007 by yonni] ____________ |
# |
February 14, 2007, 13:08 | |
Sandman
F3n!x0r 1194 posts |
Actually, you can't connect to a peer like that, because: 1. The HTTP:// is to tell browswers you want to use the HTTP protocol, not for a connection 2. The /stickmenwars/index.php is to get a specific file on a server, which also doesn't apply to opening a connection. Both things are protocol related problems, which you should solve after connecting, using "yonni.freehostia.com", which is the same as the IP. ____________ BennuWiki Yes, my avatar has grey borders in IE (so get a decent browser) ROOFLEZ ROOFLEZ |
# |
February 14, 2007, 17:03 | |
DTM
Earthling! 821 posts |
After connecting to the server you can send a string like Quote: GET /stickmenwars/index.php HTTP/1.0\r\nHost: yonni.freehostia.com\r\n\r\n Fenix will have to convert each \r\n to a newline, i'm not sure if it does that. Then you should receive the header, then a blank line and then the file. Something like: Quote: HTTP/1.0 200 OK Date: Wed, 14 Feb 2007 15:59:56 GMT Server: Apache Content-Type: text/html Proxy-Connection: close file contents But this is just the http stuff so i'm not sure how it will work with the dll. http://www.jmarshall.com/easy/http/ [Edited on February 14, 2007 by DTM] ____________ :o |
# |
February 14, 2007, 20:00 | |
Sandman
F3n!x0r 1194 posts |
If after every header line comes a \r\n, then you should use that as a seperator Code: int HTTP_Recv_File(int NetID) Private string input; string filestring; Begin // Receive header NET_Seperator(NetID,chr(13)+chr(10),2); while( (input=NET_Recv(NetID))!="") // handle the header info end // Receive File NET_Seperator(NetID,0,0); while( (input=NET_Recv(NetID))!="") filestring += input; end // Do stuff with the filestring // Reset seperator NET_Seperator(NetID,chr(13)+chr(10),2); return 0; End I haven't tested this code or anything, it's only a basis to give you some clues on how it might be done. I don't know of effects of latency on this code, or how you handle incoming data. ____________ BennuWiki Yes, my avatar has grey borders in IE (so get a decent browser) ROOFLEZ ROOFLEZ |
# |
February 14, 2007, 23:32 | |
yonni
None 420 posts |
I haven't tried that last bit of code from sandman, but so far I've got sod allback from the server. It connects fine, and sends an "established" signal, but I don't get a reply from any HTTP request I send.
____________ |
# |
February 15, 2007, 01:00 | |
Sandman
F3n!x0r 1194 posts |
Are you closing your request properly with the HTTP delimiter? \r\n is it, no? Are you getting no messages back or no bytes at all (check with NET.totaltransferred_down for example)? ____________ BennuWiki Yes, my avatar has grey borders in IE (so get a decent browser) ROOFLEZ ROOFLEZ |
# |
February 15, 2007, 19:06 | |
yonni
None 420 posts |
Its working fine now. Firstly, I wasn't getting anything from the server because I was using "NET_GetSeperator(NetID)" instead of "chr(13)+chr(10)" for the "\r\n" before I had acutally set the seperator. From then it was just a case of logically working through what information I had to get it to work. This is what I came up with: Code: process networkplay()
private int handle; string msg; int server; begin //setup and init stuff handle = NET_Open("yonni.freehostia.com",80); if(handle > -1) add_to_autoconsole("Server connection open",rgb(77,210,43)); else add_to_autoconsole("ERROR connecting to server: "+NET_GetError(handle),rgb(255,0,0)); server = servercheck(); end; HTTP_request("GET",""); loop switch(NET.Incoming[1]) case NET_STATUS_DISCONNECTED: if(server == true) add_to_autoconsole(NET_IPaddress(1)+" has disconnected [" +NET_Hostname(1) + "]",rgb(255,0,0)); else add_to_autoconsole("Disconnected from server!",rgb(255,0,0)); server = servercheck(); end; end; case NET_STATUS_INACTIVE: end; case NET_STATUS_ACTIVE: if(NET_Recv(NetID)!="") HTTP_Recv_File(); end; //msg = NET_Recv(1); //add_to_autoconsole("Incoming message from server: "+msg,rgb(0,0,255)); /*repeat add_to_autoconsole("Incoming message from server: "+msg,rgb(0,0,255)); msg = NET_Recv(1); until(len(msg)<=0)*/ end; case NET_STATUS_ESTABLISHED: NetID = 1; NET_Seperator(1,chr(13)+chr(10),2); add_to_autoconsole("Connected(1): "+NET_IPaddress(1)+" ["+NET_Hostname(1)+"]",0); end; default: add_to_autoconsole("Unknown incoming code: "+NET.incoming[1],rgb(255,0,0)); end; end; if(key(_esc)) add_to_autoconsole("Disconnecting...",rgb(255,0,0)); let_me_alone(); delete_text(0); mainmenu(); NET_Close(1); NET_Quit(); return; end; frame; end; end; //-------------------------------------------------------------------------------------------- int HTTP_Request(string request,string extensions) private handle; begin if((handle=NET_Send(1,request+" /stickmenwars/index.php"+extensions+" HTTP/1.0"+chr(13)+chr(10)+"User-Agent: StickmenwarsClient/"+VERSION+chr(13)+chr(10)+"Host: yonni.freehostia.com"+chr(13)+chr(10)+chr(13)+chr(10))) > -1) return 1; else add_to_autoconsole("Error sending request: "+NET_GetError(handle),rgb(255,0,0)); return -1; end; end; //-------------------------------------------------------------------------------------------- int HTTP_Recv_File() Private string input; Begin NET_Seperator(NetID,chr(13)+chr(10),2); while((input=NET_Recv(NetID))!="") //filestring += input; frame; end //add_to_autoconsole(filestring,rgb(100,255,255)); //filestring = ""; NET_Seperator(NetID,";",1); while((input=NET_Recv(NetID))!="" and input!=(chr(13)+chr(10))) add_to_autoconsole(input,rgb(0,0,255)); end NET_Seperator(NetID,chr(13)+chr(10),2); return 0; End //-------------------------------------------------------------------------------------------- ____________ |
# |
Page 1 , 2 , 3 , 4 , 5 , 6 , 7 |
Message Board > Fenix / Bennu / Gemix / DIV > [DLL] Network.DLL