Exuse i wrote this to use with a flash program but it seems pretty slow... Can you say me if't's correct, please?
Graphics 800,600,16,2 Print "" AppTitle "Skorp's made, Newearth Server" nip=CountHostIPs("") Global ipi,ip$,admin ipi=HostIP(1) ip$=DottedIP(ipi) DebugLog ipi Type tcpserver Field port,stream,accept End Type Type tcpclient Field ip,stream End Type Type upduser Field nom$,ipi,buf$ End Type Global updr=CreateUDPStream(10000) Global upds=CreateUDPStream(10001) If updr=0 Or upds=0 Then Print "Liberez le port "+send+" el le port "+rcv+" svp" End EndIf flashcon=CreateTCPServer(9999) If flashcon=0 Then Print "Liberez le port 9999, svp." Else While Not KeyHit(1) Color 0,0,0 Rect 0,0,800,13 Color 0,203,0 Text 0,0,commande$ Color 255,255,255 Flip key=GetKey() If key>31 And key<127 Then commande$=commande$+Chr(key) ElseIf key=8 Then commande=Mid$(commande,1,Len(commande)-1) ElseIf key=13 Then commande(commande) commande="" ElseIf KeyHit(59) commande="<prvt>"+ipi+"Hello, this is a test</prvt>" EndIf ;------------------->FLASH If flashacc=0 Then flashacc=AcceptTCPStream(flashcon) If flashacc<>0 Then Print "Connection avec le flash acceptee" sendtotcp(flashacc,"<ipi>"+ipi+"</ipi>") EndIf ElseIf ReadAvail(flashacc)<>0 Then byteflash=ReadByte(flashacc) If byteflash=0 Then commande(tampon$) Print tampon$ tampon$="" ElseIf byteflash<>0 Then tampon$=tampon+Chr(byteflash) EndIf ElseIf Eof(flashacc) Then flashacc=0 Print "Connection avec le flash perdue" EndIf ;---------------->UPD ipupd=RecvUDPMsg(updr) If ipupd<>0 Then If ReadAvail(updr)<>0 Then bupd=ReadByte(updr) For upd.upduser=Each upduser If ipupd=upd\ipi Then If bupd=0 Then Print upd\buf If flashacc<>0 Then:sendtotcp(flashacc,upd\buf):EndIf ;-------------------> commandes a distance upd\buf="" ElseIf bupd>31 And bupd<127 Then upd\buf=upd\buf+Chr(bupd) EndIf nomtmp=1 EndIf Next If nomtmp=0 Then upd.upduser= New upduser upd\ipi=ipupd upd\buf=Chr(bupd) Print "Nouvel utilisateur UPD depuis l'ip "+DottedIP(ipupd) EndIf EndIf EndIf Wend EndIf Function sendtotcp(srv,tmp$) For l=1 To Len(tmp) WriteByte (srv,Asc(Mid$(tmp,l,1))) Next WriteByte (srv,0) End Function Function sendtoupd(tmp$) For upd.upduser=Each upduser For l=1 To Len(tmp) WriteByte(upds,Asc(Mid$(tmp,l,1))) SendUDPMsg upds,upd\ipi,10000 Next WriteByte(upds,0) SendUDPMsg upds,upd\ipi,10000 Next End Function Function sendtooneupd(toipi,tmp$) For l=1 To Len(tmp) WriteByte(upds,Asc(Mid$(tmp,l,1))) SendUDPMsg upds,toipi,10000 Next WriteByte(upds,0) SendUDPMsg upds,toipi,10000 End Function Function commande(tmp$) If Len(tmp)>13 Then tagg$=Mid$(tmp,1,6) tagd$=Mid$(tmp,Len(tmp)-6,7) wtag$=Mid$(tmp,7,Len(tmp)-13) EndIf ;DebugLog tmp If essai=1 Then ElseIf tagg="<prvt>" And tagd="</prvt>" Then toipi=Mid$(wtag,1,10) wtag=Mid$(wtag,11,Len(wtag)) sendtooneupd(toipi,wtag) Else sendtoupd(tmp$);Envoye a tout le monde si pas de tags EndIf End Function