Tasharen Entertainment Forum
Support => TNet 3 Support => Topic started by: Phantom75 on September 16, 2013, 02:17:13 PM
-
Hi
I'm getting Exceptions in EndSend() - mBuffer is null when it's not supposed to be.
The calling code is:
BinaryWriter writer = BeginSend(Packet.ResponseNextWaypoint);
writer.Write(e.Guid);
writer.Write(e.WayPointNr);
writer.Write(e.X);
writer.Write(e.Y);
writer.Write(e.Z);
writer.Write(e.Speed);
EndSend(true, c, null);
The Channcel C at that time did not have any subscribers.
Cheers
Martin
-
If the channel has no subscribers, don't try to send anything to it. Responses are generally sent to a submitted client request. How can there be a request for a channel if there is no one in the channel?
-
It's NPC's that update their position to all Players in the game. So I thought I need to subscribe them all to a channel. Did I get that wrong then?
-
Er... what? Did you add some server-side AI logic into TNet? Because by default, TNet merely facilitates a way to echo packets between connected clients, and any and all AI logic would be done on the client (generally the channel's host, or the object's owner). Since it's done by a client, no client means no logic, and nothing to send.
-
Welll.... yes. It's a mmorpg and there, if you put logic into the client, they game isn't yours anymore. So yes, I enhanced the TNet Server with database logic to load data and do the AI logic. Sorry, if I haven't used TNet in a way it's not meant to be used.... :)
-
Alright, so all you're missing is just a simple check -- is there anyone in the channel? No? Then don't send. :P