END giving MAV?

Blitz3D Forums/Blitz3D Beginners Area/END giving MAV?

pexe(Posted 2005) [#1]
I was writing the NET engine for my game.. And.. I noticed that when you are the server.. and a player conects to you.. and leave.. and after that you leave the game.. the function END give a MAV. I think that it dosen't make sense.. because END should clean everything that are open..

What the hell is happening??


jfk EO-11110(Posted 2005) [#2]
Are you sure it's end? Did you try

waitkey()
end

To make sure it doesn't happen somewhere else?


Damien Sturdy(Posted 2005) [#3]
You're probrably accessing an array or bank out of bounds durnig your code. Sometimes this causes the above issue.


DH(Posted 2005) [#4]
I was writing the NET engine for my game.. And.. I noticed that when you are the server.. and a player conects to you.. and leave.. and after that you leave the game.. the function END give a MAV. I think that it dosen't make sense.. because END should clean everything that are open..


Had this happen alot myself on NET programming in Blitz...

Here is your answer:

You're not closing the streams and/or server before you exit the program.

Chances are, you close the stream on the client, but just let the stream fall off on the server (time it self out). You cant do that. You have to keep track of time (how long it has been since a client has ACTUALLY communicated through that stream) or send some sort of disconnect notice from the client. When you END the program, Blitz attempts to go back and free up the sockets (or some other general clean up) and encounters an issue with that stream not being closed..

1st Keep track of the time between data coming in from clients. If it gets to be about 8 sec and no data has been recieved, assume they timed out (or disconnected), and close the stream (I like to Nullify handles just in case). Then, before you END the program, go through and close all open streams, and make sure you close the server as well.

You will find your problem with MAV on END goes away.