Hi,
(sry bad english !)
Please i need HELP or a fix !! to get the right GnetMessageObject from a GnetMessage.
I wrote a litle Samplecode, i need GnetMessages and i got no time to write a new "lowlevel- NetLib" like Gnet for me, and Gnet allready exist and it works fine but this one problem is a Great Problem and it makes Gnet bad.
I try the Fix
http://blitzbasic.com/Community/posts.php?topic=80476
but it doesn't work
Try This code and start more Instances, every GnetObject send a Message (all 2000 Millisecs), in a normal case each Client must receive a
remote message and do print a ID string but nothing like this "Sender Is LocalClient" is happens.
thanks for any help !!
(sry bad english !)
Please i need HELP or a fix !! to get the right GnetMessageObject from a GnetMessage.
I wrote a litle Samplecode, i need GnetMessages and i got no time to write a new "lowlevel- NetLib" like Gnet for me, and Gnet allready exist and it works fine but this one problem is a Great Problem and it makes Gnet bad.
I try the Fix
http://blitzbasic.com/Community/posts.php?topic=80476
but it doesn't work
Try This code and start more Instances, every GnetObject send a Message (all 2000 Millisecs), in a normal case each Client must receive a
remote message and do print a ID string but nothing like this "Sender Is LocalClient" is happens.
'////////////////////////////////////// '/ '/ '/ '/ GNET BUG !! '/ '/ ----------------------------------- SuperStrict Import brl.gnet Global _self :TgnetHost = CreateGNetHost () Global _localclient :TgnetObject Global Port :Int =12345 Global Counter :Int If Not Join () Host () GNetListen (_self,Port) Graphics 100,40,,0 Repeat Cls If KeyHit(key_escape) Or AppTerminate () End ControlMessages () ControlObjects () If MilliSecs()-Counter > 2000 Counter=MilliSecs() SendMSG() Flip Delay (50) GNetSync (_Self) Forever Function Join:Byte() If GNetConnect (_Self,"127.0.0.1",Port,1000) _localclient = CreateGNetObject (_Self) Print "Client" AppTitle="Client" Return True EndIf End Function Function Host:Byte() _localclient = CreateGNetObject (_Self) If _localclient Print "HOST" AppTitle="HOST" Return True EndIf EndFunction Function ControlMessages() Local Message:TGnetObject If _Localclient For Message=EachIn GNetMessages(_Self) Print"______________" Print"INCOMING MSG :" Local MSGObj:TGNETOBJECT = GNetMessageObject (Message) If GNetObjectLocal (MSGObj) Print "SENDER IS LOCALCLIENT ?!!?!!" If MSGObj Local TargetObject:String = String(GetGNetTarget (MSGOBJ)) If TargetObject Print "from : "+TargetObject EndIf Next EndIf EndFunction Function ControlObjects() Local NetObject:TGnetObject If _Localclient For NetObject=EachIn GNetObjects(_self) If GNetObjectLocal (NetObject) Continue Local State:Int=NetObject.State() Select State Case Gnet_Closed Print"________________" Print"Client CLOSED :" Local TargetString:String = String(GetGNetTarget (NetObject)) If TargetString Print "ID : > "+TargetString+" <" Continue Case Gnet_Created Print"________________" Print"Client Created :" SetGNetTarget (NetObject ,String("REMOTECLIENT :"+String(MilliSecs())) ) Local TargetString:String = String(GetGNetTarget (NetObject)) If TargetString Print "ID : > "+TargetString+" <" EndSelect Next EndIf EndFunction Function SendMSG() Local MSG :TGNETOBject = CreateGNetMessage (_self) Local RCVClient:TGNETOBject '= _localclient For RCVClient = EachIn GNetObjects(_Self) If GNetObjectLocal (RCVClient) Print "MSG RCVR is LocalClient MSG not send !!" Continue SendGNetMessage (Msg,RCVCLient) Print "SEND" Next EndFunction
thanks for any help !!