Hello to all.
Anybody have can use this dll in bennu wip 2?
In afirmative case. How?
Thanks.
yes, download bennu version from:
http://bennupack.blogspot.com/
http://coldev.net76.net/bennu/examples/
mirror
netsandman
http://www.filefactory.com/file/01b2dd/n/Netsandman_zip
Network.dll for Bennu (http://wiki.bennugd.org/index.php?title=DLL:Network.DLL#Download)
Great news Sandman, thanks for your work!
And a new version for the current Bennu line. Don't know if anyone still uses this library, but it was an easy fix anyway.
* http://wiki.bennugd.org/index.php?title=DLL:Network.DLL
* 1.56 Win32 binaries, source and documentation (http://wiki.bennugd.org/images/1/15/Libnetwork-v1.56-win32.zip)
Changelog:
18-11-09: v1.56:
Fixed functions export bug
Thanks!
Can you tell us what improvements or extra functionalities this library has in front of Fsock, for example?
THis dll works great with Bennu unlike in Fenix me and Ecko had many problems in the Dune project =P
shame there is no way to use UDP with that dll :(
Fsock is not easy for beginners. This dll is not as fast, but is easier in use. Some of the features that make it easier:
* One command setup, another one for listening for connections (server) or one for opening a connection (client).
* 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).
If you know how fsock works, stick with it, because it's faster and supports more than just TCP. But if you are not comfortable with sockets, this dll is nice. See the IRC chat tutorial (http://wiki.bennugd.org/index.php?title=Tutorial:IRCchat) for an example of how to create an IRC client with this dll.
Fantastico, niet wetende dat zoiets bestond voor Fenix en Bennu :)
networking.dll...
Ok, I was trying with fsock last week and building a client-server with 2 clients handling 2D processes... I couldn't find a good protocol, the server blocked all time... I will try with networking, thanks.
thanks sandman... where are yours fuckins karma??!!! you need visit more bennugd... ;)
Hi Sandman, im cheking the NETv1.54a tester and have some doubts...
It runs using the Fenix interpreter: It is just for Fenix or it must work with Bennu too?
Im trying to compilate the test using Bennu dlls, but i have the first error on:
INCLUDE "Fenix.fh";
The file Fenix.fh doesnt exist on the test folder... And the following line is:
INCLUDE "extra.inc";
And other .inc files doesnt exist...
I almost understand the rest of the code, but I want to know if it is/will be possible to build a program in Bennu by the beggining using your library. It looks great ;)
EDIT: Yeah, I could compile and run the example on the wiki, anyway if you can answer any of my questions it would be great, the wiki example is not as good as that "Fenix" sample :P
EDIT 2: I'm not a lucky man... I am trying to build a Bennu program from the beggining with network library, my first error comes when using net_init:
init_status = net_init ( 0 , 10 , 1 );
IF ( init_status == NET_ERROR_ALREADYINIT )
exit ( "Error, libnetwork already initialized" );
ELSEIF ( init_status == NET_ERROR_INITIALIZATION )
exit ( "Error, libnetwork general initialization error" );
ELSEIF ( init_status == NET_ERROR_TOOFEWCONNS )
exit ( "Error, too few connections on libnetwork initialization" );
ELSEIF ( init_status == NET_ERROR_TOOMANYLISTENERS )
exit ( "Error, too many listeners specified on libnetwork initialization" );
ELSEIF ( init_status == NET_ERROR_NONE )
say ( "libnetwork initialized correctly" );
ELSE
exit ( "Unknown error on libnetwork initialization" );
END
I check all possible errors, but I always take a non specified value and get a "Unknown error on libnetwork initialization".
Im using libnetwork.dll v1.56 d18-m11-y2009 :'(
Sorry, I can't find the complete code of that tester anymore. It included lots of other includes I used often. It can only run on the Fenix interpreter, it's a standalone program. Type "NET HELP" to get some help.
I highly recommend the IRC Chat tutorial. It's complete and works. It doesn't show all of the functionality, but it does show the basics. Try it out and we'll chat some. ;-)
Can your variable init_status take negative values? If not, then that's the problem. I think the DLL says the function returns a dword, but that should be an int.
init_status is an int, im goig to try it with dword, but I think it will be the same
The IRC example is too complex for begineers, I just want 2 players (squares) to move on screen from remote location, that's all, but with a net_init error it goes bad :-\
Thanks, I keep trying.
Can you send me the code? Your email address is for MSN too?
EDIT:
net_init returns a wrong value, don't know yet why. However, it does initialize libnetwork correctly. Turn on debugging by enabling NET.consolereports (http://wiki.bennugd.org/index.php?title=NET_Globals):
NET.consolereports = 1;
You can continue as if it goes ok... looking at it now.
EDIT2:
Found it. That value is the processID of the network process that gets executed at initialization. It's not a real error, because every error is negative and positive values are allowed. Well that's the way I made the DLL. But I think it differs from the documentation, so I will fix it. Thanks!
Hi Sandman,
I have chequed it, and net_init returns 65538 always, even if network switch is off :P
Ok, i will try it, check your forum mail box, I send you my instant message contact
Thanks for the consolereports tip and karma++
Woops, didn't see your post, was on second page, hehe. Well error found anyway and documentation fixed.
Let me know how it's going. :)
Hi Sandman, bad news :S
I'm trying to write a VERY VERY VERY simple client server program. Server just send "HOLA" to client on local host at every FRAME and client just listen and say what it receives from the server.
Server run first and always say connection 0 invalid, and client shows an empty string...
Here the full code, it is very simple:
QuoteIMPORT "mod_key";
IMPORT "mod_grproc";
IMPORT "mod_string";
IMPORT "mod_text";
IMPORT "mod_say";
INCLUDE "libnetwork.inc";
CONST
_SERVER_IP = "192.168.0.11";
_SERVER_PORT = 6112;
END
GLOBAL
//
END
PROCESS main ( )
PRIVATE
init_status;
BEGIN
NET.ConsoleReports = TRUE;
init_status = net_init ( 0 , 10 , 1 ); // It always returns 65538, can't check errors by now
menu ( );
REPEAT
FRAME;
UNTIL ( key ( _ESC ) );
// Disconnect and quit.
net_quit ( );
let_me_alone ( );
END
FUNCTION menu ( )
BEGIN
write ( 0 , 0 , 0 , 0 , "Key 1 for server" );
write ( 0 , 0 , 10 , 0 , "Key 2 for client" );
LOOP
IF ( key ( _1 ) ) server ( ); BREAK; END
IF ( key ( _2 ) ) client ( ); BREAK; END
FRAME;
END
END
PROCESS server ( )
PRIVATE
int connection = 0;
BEGIN
connection = net_listen ( _SERVER_PORT , TRUE );
LOOP
net_message ( connection , "HOLA" );
FRAME;
END
END
PROCESS client ( )
PRIVATE
int connection;
string message;
BEGIN
connection = net_connect ( _SERVER_IP , _SERVER_PORT , TRUE );
LOOP
message = net_getmessage ( connection );
say ( message );
FRAME;
END
END
Correct. You are trying to send a message to a listening port, but this is not a valid connection. When the client connects to the server, the server will create a new connection for that client.
So what you need to do in the server:
- open listening port (like you do)
- wait for client and a NEW connection
- send messages to client
I'm unsure about how the waiting part is best done. Hm I didn't make this part easy enough. What you can do is:
PROCESS server ( )
PRIVATE
int connection = 0;
BEGIN
connection = net_listen ( _SERVER_PORT , TRUE );
Loop
switch(NET.Incoming[1])
case NET_STATUS_ESTABLISHED:
// code when the connection is just established
say("# Connected!");
break;
end
end
frame;
End
LOOP
net_message ( 1 , "HOLA" );
FRAME;
END
END
But this is an incredibly ugly hack. I didn't think about this enough. I will make it better.
I added two new functions:
* NET_Incoming_Accept (http://wiki.bennugd.org/index.php?title=NET_Incoming_Accept)
* NET_Accept (http://wiki.bennugd.org/index.php?title=NET_Accept)
In your program you can use them like this:
IMPORT "mod_key";
IMPORT "mod_grproc";
IMPORT "mod_string";
IMPORT "mod_text";
IMPORT "mod_say";
INCLUDE "libnetwork.inc";
CONST
_SERVER_IP = "localhost";
_SERVER_PORT = 6112;
END
GLOBAL
//
END
PROCESS main ( )
PRIVATE
init_status;
BEGIN
NET.ConsoleReports = TRUE;
init_status = net_init ( 0 , 10 , 1 ); // It always returns 65538, can't check errors by now
menu ( );
REPEAT
FRAME;
UNTIL ( key ( _ESC ) );
// Disconnect and quit.
net_quit ( );
let_me_alone ( );
END
FUNCTION menu ( )
BEGIN
write ( 0 , 0 , 0 , 0 , "Key 1 for server" );
write ( 0 , 0 , 10 , 0 , "Key 2 for client" );
LOOP
IF ( key ( _1 ) ) server ( ); BREAK; END
IF ( key ( _2 ) ) client ( ); BREAK; END
FRAME;
END
END
PROCESS server ( )
PRIVATE
int listen_connection = -1;
int connection = -1;
BEGIN
listen_connection = net_listen ( _SERVER_PORT , TRUE );
/* Method 1*/
// Loop
// say(NET.Incoming[listen_connection]);
// switch(NET.Incoming[listen_connection])
// case NET_STATUS_ESTABLISHED:
// // code when the connection is just established
// say("# Connected!");
// connection = net_incoming_accept(listen_connection);
// break;
// end
// end
// frame;
// End
/* Method 2*/
connection = net_accept(listen_connection);
// etc
LOOP
net_message ( connection , "HOLA" );
FRAME;
END
END
PROCESS client ( )
PRIVATE
int connection;
string message;
BEGIN
connection = net_connect ( _SERVER_IP , _SERVER_PORT , TRUE );
LOOP
message = net_getmessage ( connection );
say ( message );
FRAME;
END
END
It took some effort to remain backwards compatible, but at least in this example it works properly. Hope this of more use to you.
I'll check it in a while, thanks an other karma up xD
Well, "little" bad news...
I have tried your new functions now, but I have an error:
Undefined procedure: NET_ACCEPT
I suposse that function is added on the new version, but I have downloaded from the Wiki the libnetwork.dll v1.57 Win32 for Bennu and its the same version of the dll I had... Where can I find the new version you made? I have taken a look on boolean soup and can't find it... :'(
Help...
Here is a very first functional version of simple communication client/server:
http://trinit.es/DescargaDirecta/BennuDLL/NetworkTest/Windgate's%20Network%20Test%200.0.1.zip
Next step: Two remote clients moving on screen...
Well, here is a very stupid version of a 2 players game, the server is a player and the client is the other player, and it is possible to move players using keys. You can change the IP at /prg/const.prg, the current IP is my own IP :P
DOWNLOAD: http://trinit.es/DescargaDirecta/BennuDLL/NetworkTest/Windgate's%20Network%20Test%200.0.1b.zip
PD: On remote connection remember that you must open 6112 port, or change it at /prg/const.prg
I tried to build the network.dll using CodeBlocks, Sandman helps me a fucking lot with this, I had to download all Bennu source and some SDL files... Im not used to do this weird things, so I have make a CodeBlocks projects with ALL, ready to build and go.
Anyone wants to try it?
DOWNLOAD: http://trinit.es/DescargaDirecta/BennuOthers/DLL%20build%20sample.zip
:P
Now a Linux version available at the great wiki (http://wiki.bennugd.org/index.php?title=DLL:Network.DLL#Download).
Your project works here, but that could also be because I've got a global setup. But, the dependencies are there (except libbgdrtm).
Quote from: Windgate on December 03, 2009, 01:12:40 PM
I tried to build the network.dll using CodeBlocks, Sandman helps me a fucking lot with this, I had to download all Bennu source and some SDL files... Im not used to do this weird things, so I have make a CodeBlocks projects with ALL, ready to build and go.
Anyone wants to try it?
DOWNLOAD: http://trinit.es/DescargaDirecta/BennuOthers/DLL%20build%20sample.zip
:P
Hey, i will take a look to this. It's very interesting and i will need it (but now i'm REALLY busy to test, sorry).
Jusk karma up to both of you.
Sandman, I have take off the global setup :P
My next step: Compile any dlls of Bennu
But I want to make playable my network test first, maybe in 3D xD
Bad news, I'm working on a protocol which can allow the server to accept many connected clients.
The protocol is not functional yet, but I have a first error when I listen again to accept a new client when the first one is connected:
GLOBAL
int connections [ _MAX_CLIENTS ];
int connected_clients = 0;
END
PROCESS accept ( )
PRIVATE
int listen_connection [ _MAX_CLIENTS ];
BEGIN
write ( 0 , 0 , 0 , 0 , "Connected clients: " );
write_var ( 0 , 120 , 0 , 0 , connected_clients );
LOOP
listen_connection [ connected_clients ] = net_listen ( _SERVER_PORT , TRUE );
connections [ connected_clients ] = net_accept ( listen_connection [ connected_clients ] );
connected_clients++;
FRAME;
END
END
I get an error on the server program when the first client connects and the accept() process tries to listen again:
"Error, could not listen on connection"
S.O.S dear Mr. Sandman :(
You only tell the dll once that you want to listen on a port, not multiple times. It will allow multiple clients to connect. If you want to stop listening, use net_disconnect() on the listening connection. So just move that line outside of the loop and you're done.
EDIT: codes
GLOBAL
int connections [ _MAX_CLIENTS ];
int connected_clients = 0;
END
PROCESS accept ( )
PRIVATE
int listen_connection;
BEGIN
write ( 0 , 0 , 0 , 0 , "Connected clients: " );
write_var ( 0 , 120 , 0 , 0 , connected_clients );
listen_connection = net_listen ( _SERVER_PORT , TRUE );
LOOP
connections [ connected_clients ] = net_accept ( listen_connection );
connected_clients++;
FRAME;
END
ONEXIT
net_disconnect( listen_connection ); // NOTE: this will NOT disconnect all the clients...
END
Thats good Sandman, I don't have that error now... But I have a new problem.
The new clients keep only making Outgoing conections, but the program is made to have both, in and out, server communicates with all clients.
It is rare, I am tired to keep programming now, here is the link of the current version, /prg/multi_server.prg has the new server code, is a very simple protocol.
DOWNLOAD: http://trinit.es/DescargaDirecta/BennuDLL/NetworkTest/Windgate's%20Network%20Test%200.0.2.zip
Note that i DONT want to have a multiplayer game, I am only trying to have communication with many clients, the protocol is not ready to have many clients working moving on the screen, only is ready to communicate with them.
I an working on a local machine with many clients using the same port, could ir be the reason for the current problem?
Thanks a lot again and again Sandman :P
Fixed: http://wiki.bennugd.org/images/1/14/Libnetwork-v1.59-win32.zip
Linux version soon, or on request.
I'm not happy with this DLL. I tried to mimic the frame behaviour of Bennu, but that just plainly sucks if you ask me. I'll be making a new one in the future, one with events, UDP and some nice tricks I have in mind.
I like the simplicity of this dll, it has some "weird" things but is really better than the sockets one.
Trying your fix, thanks, but, which are the changes?
Ok! Lets see...
Im testing out this network dll. Seems really more easy to use for a non-pro socket users.
Right now, Im programming the classic "Pong" arcade for play online, but seems Im not doing it properly. Im using a server between 2 clients to be able to communicate them, I mean, both clients get online on the server and the server give them the signal to start the game. Each movement from clients is sending to the server and the server sends the info back to the clients.
The movements from clients works really properly and syncronized, at least I think so. The problem comes out when I try add a new process called "ball". I dunno how really can syncronize it on both clients. I tried sending diferent kinds of messages to the server but not working at all.
Working good now, but the ball got de-syncronized sometimes...
Sandman, I would be really pleased If you can check it out. Im sure you will find more ideas to do that the ball works properly! ::)
Thanks!
Link: http://www.mediafire.com/?zty22jzfz2z
Last version : http://www.mediafire.com/?mulnmtaqmmm (http://www.mediafire.com/?mulnmtaqmmm)