Gnet and its use... need help :p
BlitzMax Forums/BlitzMax Beginners Area/Gnet and its use... need help :p
| ||
Hi ! Ok I'm trying to understand how does GNet work. I try to make a little server/client (separated) program that juste print on each client the name of each client (inclued himself) connected, I'm currently testing on local but It doesn't work cuz I don't realy know how to do this... that's why I beg your help :) server.bmx Local host:TGNetHost=CreateGNetHost() While Not KeyHit(KEY_ESCAPE) GNetListen(host,9000) GNetSync(host) GNetAccept(host) Wend client.bmx Local host:TGNetHost=CreateGNetHost() Local localclient:TGNetObject=CreateGNetObject(host) Local nick:String=Input() Const slot_name = 0 SetGNetString localclient,slot_name,nick GNetConnect(host,"127.0.0.1",9000) While Not KeyHit( KEY_ESCAPE ) GNetSync(host) RefreshName() Wend Function RefreshName() For Local obj:TGNetObject=EachIn GNetObjects(host) Print GetGNetString(obj,0) Next EndFunction any help would be appreciated |
| ||
All a client-side problem you had to send the function the host variable, because its a function, not a method. ........ While Not KeyHit( KEY_ESCAPE ) GNetSync(host) RefreshName(host) Wend Function RefreshName( thehost:TGNetHost ) For Local obj:TGNetObject=EachIn GNetObjects( thehost ) Print GetGNetString(obj,0) Next EndFunction ....... |