Lol
Back to the future rocks
Sorry to bother you with some *bugs* (well, I think that they're =) )
If you send bigs packets, everything seems fine, but if you send tons of little packets, it's seems that not all of them are received.
Here's the proof :
connection=net join("127.0.0.1")
if connection=0
server=1
IP$="127.0.0.1"
hosting=net host(2,IP$)
else
server=0
endif
net stack on
if server=1
repeat
newp = net new player()
until newp>0
for a = 1 to 100
net push char 124
net send newp
wait 100
next a
endif
if server=0
nbmsg=0
nomsg=0
do
if net receive(1)=1
msgAmount = net get msg amount()
for x=1 to msgAmount
net get msg
buff=net pop char()
inc nbmsg
next x
nomsg=0
else
nomsg=nomsg+1
endif
if nomsg>1000 then exit
loop
if file exist("output.txt")=1 then delete file "output.txt"
open to write 1,"output.txt"
write string 1,str$(nbmsg)
close file 1
endif
Here's a little code I did fast, perhaps there's a problem in the code, but anyway. (Run the same code twice, once for the Server, the second will act as client)
In this case, every packet is safely delivered
but if you remove the wait 100, like this (sorry for the long code again):
connection=net join("127.0.0.1")
if connection=0
server=1
IP$="127.0.0.1"
hosting=net host(2,IP$)
else
server=0
endif
net stack on
if server=1
repeat
newp = net new player()
until newp>0
for a = 1 to 100
net push char 124
net send newp
next a
endif
if server=0
nbmsg=0
nomsg=0
do
if net receive(1)=1
msgAmount = net get msg amount()
for x=1 to msgAmount
net get msg
buff=net pop char()
inc nbmsg
next x
nomsg=0
else
nomsg=nomsg+1
endif
if nomsg>1000 then exit
loop
if file exist("output.txt")=1 then delete file "output.txt"
open to write 1,"output.txt"
write string 1,str$(nbmsg)
close file 1
endif
well, approximatively 25 packets out of the 100 sent are received... as output.txt reported it
Another fact :
I've checked with NetLimiter the amout of bytes sent by *this* program...
Either way is giving 0,29kb, so I think it's sending properly all these little packets...
Let me know if there's a workaround or some advices, or explanations, about this?
Btw i have the last version of MultiSync (0.5.1)
Oh, and, I know that this example is pretty excessive, there's no way someone will send that amount of data in such a small time, but it's only to show you that for exemple (my problem
), if I want to send position X,Y,Z in my game, and send another packet at the same time containing, for example, the input of someone's chat...
I can end up doing a big packet, but little packets are less anoying to program