- This wiki is out of date, use the continuation of this wiki instead
DLL:Network.DLL
From FenixWiki
Revision as of 01:56, 1 September 2007 (edit) Sandman (Talk | contribs) m (Redirecting to Network DLL) ← Previous diff |
Current revision (09:53, 18 August 2008) (edit) (undo) Eckolin (Talk | contribs) m |
||
(3 intermediate revisions not shown.) | |||
Line 1: | Line 1: | ||
- | # | + | [[Category:dll]] |
+ | [[Category:networkdll]] | ||
+ | |||
+ | [[DLLs|'''Up to DLL's''']] | ||
+ | ---- | ||
+ | |||
+ | |||
+ | == Definition == | ||
+ | Network.DLL is a [[DLL]] for internet/network communication between two [[Fenix]] | ||
+ | programs or a Fenix program and a different program. It handles quite a few | ||
+ | things on its own, so the user can focus on different things in his program. | ||
+ | |||
+ | == Features == | ||
+ | * One command setup, another one for listening for connections (server) or one for opening a connection (client). | ||
+ | * Connection status monitor, informs Fenix of the status of the connections. | ||
+ | * Sending and receiving of variables of all [[datatypes]], [[graphic]]s, files, whatever you want. | ||
+ | * Download/upload meter, for measuring of speeds and totals. | ||
+ | * Automatic message separation (separation string specifiable). | ||
+ | * Dynamic messagebuffer provides limitless sending and receiving. | ||
+ | |||
+ | == How to use == | ||
+ | To be able to use it, you must include the Network.DLL functionality: | ||
+ | <pre>include "Network.fh";</pre> | ||
+ | First you initialize Network.DLL: | ||
+ | <pre>NET_Init(0,10,1);</pre> | ||
+ | From this point you can do whatever you like, for example connect to google on port 3435: | ||
+ | <pre>NetID=NET_Open("www.google.com",3435);</pre> | ||
+ | And send a message: | ||
+ | <pre>NET_Message(NetID,"Hello!");</pre> | ||
+ | Or listen for connections on port 4555: | ||
+ | <pre>NET_Listen(4555);</pre> | ||
+ | |||
+ | Receiving and handling messages is also easy: | ||
+ | <pre> | ||
+ | Loop | ||
+ | switch(NET.Incoming[NetID]) | ||
+ | case NET_STATUS_DISCONNECTED: | ||
+ | // code when the connection is disconnected | ||
+ | say("# Disconnected!"); | ||
+ | end | ||
+ | case NET_STATUS_INACTIVE: | ||
+ | // code when the connection is idle | ||
+ | end | ||
+ | case NET_STATUS_ACTIVE: | ||
+ | // code when there are >0 new messages on the connection | ||
+ | while( len(message=NET_Recv(NetID))>0 ) | ||
+ | // handle the message | ||
+ | say("< " + message); | ||
+ | end | ||
+ | end | ||
+ | case NET_STATUS_ESTABLISHED: | ||
+ | // code when the connection is just established | ||
+ | say("# Connected!"); | ||
+ | end | ||
+ | end | ||
+ | frame; | ||
+ | End | ||
+ | </pre> | ||
+ | |||
+ | == Future == | ||
+ | It probably will have UDP support as well, though at the moment only TCP is used. | ||
+ | |||
+ | == Download == | ||
+ | Here's the complete package containing a simple testprogram with commented source, the DLL, the sourcecode and full documentation: | ||
+ | |||
+ | * [[Media:NETv1.54a(Fenix0.83b).zip|Network.DLL v1.54a for Fenix 0.83b]] | ||
+ | * [[Media:NETv1.54a(Fenix0.84a).zip|Network.DLL v1.54a for Fenix 0.84a]] | ||
+ | * [[Media:NETv1.54a(Fenix0.92a).zip|Network.DLL v1.54a for Fenix 0.92a]] (also 0.93 and before 0.92a) | ||
+ | * [[Media:NETv1.54a_Tester.zip|Network.DLL v1.54a Tester]] | ||
+ | * [[Tutorial:IRCchat|Network.DLL v1.54a Example]] | ||
+ | |||
+ | Requires ''SDL_Net.DLL'' (included in package). | ||
+ | |||
+ | == Documentation == | ||
+ | * [[:Functioncategory:networkdll|Network.DLL functions]] | ||
+ | * [[NET_Globals|Network.DLL globals]] | ||
+ | * [[NET_Defines|Network.DLL defines]] | ||
+ | * [[NET_Errorcodes|Network.DLL errorcodes]] | ||
+ | * [[NET_Changelog|Network.DLL changelog]] | ||
+ | |||
+ | == Links == | ||
+ | * [http://www.booleansoup.com/index.php?p=32&mode=viewtopic&id=430&page=0 News, download links and releases of Network DLL on Booleansoup] | ||
+ | |||
+ | {{Netdocbox}} | ||
+ | {{Dllbox}} |
Current revision
Contents |
[edit] Definition
Network.DLL is a DLL for internet/network communication between two Fenix programs or a Fenix program and a different program. It handles quite a few things on its own, so the user can focus on different things in his program.
[edit] Features
- One command setup, another one for listening for connections (server) or one for opening a connection (client).
- Connection status monitor, informs Fenix of the status of the connections.
- Sending and receiving of variables of all datatypes, graphics, files, whatever you want.
- Download/upload meter, for measuring of speeds and totals.
- Automatic message separation (separation string specifiable).
- Dynamic messagebuffer provides limitless sending and receiving.
[edit] How to use
To be able to use it, you must include the Network.DLL functionality:
include "Network.fh";
First you initialize Network.DLL:
NET_Init(0,10,1);
From this point you can do whatever you like, for example connect to google on port 3435:
NetID=NET_Open("www.google.com",3435);
And send a message:
NET_Message(NetID,"Hello!");
Or listen for connections on port 4555:
NET_Listen(4555);
Receiving and handling messages is also easy:
Loop switch(NET.Incoming[NetID]) case NET_STATUS_DISCONNECTED: // code when the connection is disconnected say("# Disconnected!"); end case NET_STATUS_INACTIVE: // code when the connection is idle end case NET_STATUS_ACTIVE: // code when there are >0 new messages on the connection while( len(message=NET_Recv(NetID))>0 ) // handle the message say("< " + message); end end case NET_STATUS_ESTABLISHED: // code when the connection is just established say("# Connected!"); end end frame; End
[edit] Future
It probably will have UDP support as well, though at the moment only TCP is used.
[edit] Download
Here's the complete package containing a simple testprogram with commented source, the DLL, the sourcecode and full documentation:
- Network.DLL v1.54a for Fenix 0.83b
- Network.DLL v1.54a for Fenix 0.84a
- Network.DLL v1.54a for Fenix 0.92a (also 0.93 and before 0.92a)
- Network.DLL v1.54a Tester
- Network.DLL v1.54a Example
Requires SDL_Net.DLL (included in package).
[edit] Documentation
- Network.DLL functions
- Network.DLL globals
- Network.DLL defines
- Network.DLL errorcodes
- Network.DLL changelog
[edit] Links
Network.DLL Documentation | |
Main • Functions • Globals • Defines • Errorcodes • Changelog |
DLL's | |
• Explosion.DLL • GUI.DLL • Image.DLL • LCD.DLL • Log.dll • MPEG.DLL • Mixer.DLL • Network.DLL • TTF.DLL • |