ThreadBoard ArchivesSite FeaturesActiveworlds SupportHistoric Archives |
problem is aw_address (Sdk)
problem is aw_address // Sdkdm mercuryMar 3, 2004, 5:12pm
I have been trying to make it so IP's are correctly logged when ever an
event occurs. However when there are multiple people in the world, the IP that is looked up is reported as the same number as the first IP found on avatar add events. When chat occurs it displayes the correct IP so does exiting the world and object / avatar clicks. I have tried the code in VB (com wrapper), Microsoft Visual c++ and dev c++, all produce the same results. Maybe i have made a dummy error with something, but i just cant seem to see why i am getting the same result for the IP. this is the psudo code sdk.aw_addres(aw_int(aw_avatar_session)); log (event, sdk.aw_int(aw_avatar_address), msg); tony mMar 3, 2004, 9:17pm
[View Quote]
You have to use the aw_address() callback. I ran into this same problem with the ChatRelayBot :)
milestegMar 3, 2004, 9:21pm
hi DM Mercury, i use aw_address without problem but i don t use it like in
your pseudo code. aw_address is a blocking function so you can t be sure of the context when it returns because while in a blocking function , events can be raised. that s why i suggest you use the callback. a rule of thumb is to never use a blocking function in an event handler. blocking function may appear simpler to use but they lead to many trouble in a non trivial bot. another point is that aw_address asks the world for the ip of the user so you should do it only once, in the avatar_add event and then save the result and associate it with this aw_session so you don t waste time asking the server again and again :) Regards, MilesTeg "dm mercury" <dmmercury at houston.rr.com> a écrit dans le message de news:40462e14 at server1.Activeworlds.com... > I have been trying to make it so IP's are correctly logged when ever an > event occurs. However when there are multiple people in the world, the IP > that is looked up is reported as the same number as the first IP found on > avatar add events. When chat occurs it displayes the correct IP so does > exiting the world and object / avatar clicks. > > I have tried the code in VB (com wrapper), Microsoft Visual c++ and dev c++, > all produce the same results. Maybe i have made a dummy error with > something, but i just cant seem to see why i am getting the same result for > the IP. > > this is the psudo code > > sdk.aw_addres(aw_int(aw_avatar_session)); > log (event, sdk.aw_int(aw_avatar_address), msg); > > strike rapierMar 5, 2004, 5:17pm
aw_address has to query the server due to the information not being sent on
the avatar enter event, as such you need to use the callback function to recieve the data and check the rc, and session, and compare it. I know it can be annoying but take a look at some advanced loggers, they first pull up the information on an av, dispach an aw_address function on callback, and when they recieve that they then ReverseDNS and WhoIs the information afterwards, that too using callbacks. - MR [View Quote] |