Dnet is easy when you follow the steps:
1- create packets:
sendpacket = mn create packet()
recvpacket = mn create packet()
2- set send packet memory size (you can change it later)
mn set memory size sendpacket,size->DWORD
3- start engine:
mn start noofinstances, noofthreads->better 0
4- create instance profile:
profile = mn create instance profile()
mn set profile local profile,ip$,port,ip$,port
now this command is not important on the client side.
port: every computer or a server have communication ports from 1 to WORD. if you are using normal computer then, you shouldn't worry much which port you choose so put 6789. however if your app is running from a server then you'd better manually configure you free ports this way you make the receiving and sending data faster for the serever.
5- choose your sending type:
mn set profile instane udp profile, mode
mode: 1 : all the sending packets should have the same size. none of them will wait in the receiving queue(very efficient and fast)
2: sending packets don't have to be with the same size. none of them will wait in the receiving queue.
3: packets are ready to wait in the queue but may lost in transmission (half way TCP).
4: the same as mode 3 but more efficient because badly received packets are dicarded.
mn set profile local TCP profile, mode
mode: 1 (default) for normal computers.
0 will disable automatic handshaking. this is used for servers.
you better use UDP mode in computer games. TCP is better used in server that must not loose connection such as filling application forms or waiting for transactions.....
6- start hosting:
repeat until mn start server(instanceno, maxcients,profile) = 0 //0 means server has started correctly.
7- wait for clients:
newclientno = mn client joined(instanceno) // return 0 if no one
joined.
leftclientno = mn client left(instanceno)
put this comand in your game loop.
8- on the client side:
use this function:
repeat until client_connect(IP$,time_out)=1
function client_connect(IP$,time_out)
mn start 1,0
profile=mn create instance profile()
connect=mn connect(0,IP$,portno,IP$,portno,time_out,1,profile)
if connect<>1 then mn delete instance profile profile : mn finish 0 : exitfunction 0
endfunction 1
9- by now you have created server client connection.
10- packets:
if you are sending one message then use TCP packet commands.
if you are sending a lot of messages (in loop), you better use udp packet commands.