DirectPlay Problem
Übersicht

Yellow PfeifferBetreff: DirectPlay Problem |
![]() Antworten mit Zitat ![]() |
|
---|---|---|
Hoi
ich bin mir dessen bewisst, dass DirectPlay net so der hammer ist, aber dennoch möcht ich des ganz gerne damit machen. ALso, ich hab eim Programm, dass für mehrere Teilnehmer ein Ping ausgibt, also immer wieder die rechner untereinander anpingt. Aber irgendwie kommt nur ein einziges Ping wieder zurück, danach geht nix mehr... Hier der Code: Code: [AUSKLAPPEN] Graphics 320,240,32,2 SetBuffer BackBuffer() AppTitle "Ping-Test" sit = StartNetGame() lokal = CreateNetPlayer(MilliSecs()) Color 0,255,0 Global waittime = 500 Type pcs Field ip$ Field pc Field lasttime Field sendbytes Field recvbytes Field sendpings Field recvpings Field ping End Type Repeat Cls msg = RecvNetMsg() If msg Then msgtype = NetMsgType() DebugLog "Type: "+msgtype+" - Data: "+NetMsgData$()+" - From: "+NetMsgFrom() If msgtype = 100 Then rpc.pcs = New pcs rpc\pc = NetMsgFrom() rpc\ip$ = NetPlayerName$(rpc\pc) time = MilliSecs() SendNetMsg 2,time,lokal,rpc\pc rpc\sendbytes = Len(time) rpc\lasttime = time rpc\sendpings = 1 ElseIf msgtype = 2 Then from = NetMsgFrom() msgdata = Int(NetMsgData$()) SendNetMsg 3,msgdata,lokal,from For rpc.pcs = Each pcs If rpc\pc = from Then rpc\recvbytes = rpc\recvbytes + Len(msgdata) rpc\recvpings = rpc\recvpings + 1 End If Next ElseIf msgtype = 3 Then from = NetMsgFrom() msgdata = Int(NetMsgData$()) time = MilliSecs() For rpc.pcs = Each pcs If rpc\pc = from Then rpc\ping = time - msgdata Exit End If Next End If End If updatepcs() showpcs() Flip Until KeyHit(1) SendNetMsg 1,"end",lokal,0 StopNetGame() End Function showpcs() Local i For rpc.pcs = Each pcs Text 0,i*50,rpc\ip$ Text 10,i*50+10,"Ping: "+rpc\ping+" ms" Text 10,i*50+20,"Erhalten: "+rpc\recvbytes+" Bytes" Text 10,i*50+30,"Gesendet: "+rpc\sendbytes+" Bytes" Text 10,i*50+40,"Pings: "+rpc\recvpings+" / "+rpc\sendpings i = i + 1 Next End Function Function updatepcs() For rpc.pcs = Each pcs time = MilliSecs() If time >= (rpc\lasttime+waittime) Then SendNetMsg 2,time,lokal,rpc\pc DebugLog "senden an: "+rpc\pc rpc\lasttime = time rpc\sendpings = rpc\sendpings + 1 rpc\sendbytes = rpc\sendbytes + Len(time) End If Next End Function |
||
Pentium D 3000Mhz Dual Core
NVidia Geeforce 6800 GT 1024 MB DDR Ram 160 GB WinXP Home |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group