Re: Proper disconnection with Podsixnet?

2020-07-09 Thread AudioGames . net Forum — Developers room : chrisnorman7 via Audiogames-reflector


  


Re: Proper disconnection with Podsixnet?

I've not used Python for a while, but Twisted used to be great for most networking stuff.

URL: https://forum.audiogames.net/post/550360/#p550360




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Proper disconnection with Podsixnet?

2020-07-08 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: Proper disconnection with Podsixnet?

@7I mean, it's not something you should know.  The only people who know how to do this are the people who get into monkeypatching.  It's a horrible horrible hack.How Python importing actually works is that it creates global variables in your file, then assigns the module to those variables, or assigns the names from the module to those variables, depending on the import syntax.  But modules are actually objects, they're even garbage collected if you bother to remove them from the module cache, you can even pass them to functions, not that you ever should, mind you.  But you can.  Try import sys at a Python shell, then just typing sys by itself.

URL: https://forum.audiogames.net/post/550075/#p550075




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Proper disconnection with Podsixnet?

2020-07-08 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Proper disconnection with Podsixnet?

I see. Thank you. It was not my choice to use the library, I had negative experiences with it beforehand. I will pass your message along.In retrospect I should have known that importing connection from the module would cause issues, but I did not realize that it raises the problem of namespaces. Shows you how little I know regardless of working with this for over a year and a half now...Again, thank you for the assist.

URL: https://forum.audiogames.net/post/550062/#p550062




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Proper disconnection with Podsixnet?

2020-07-08 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: Proper disconnection with Podsixnet?

@5To replace a variable in a module, you must do:import mymod
mymod.thing = 5Not:from mymod import thing
thing = 5The latter introduces a new name in the current scope. IN general this strategy is flawed anyway.  You can't actually fully reliably replace global variables in modules like this for a long list of reasons.  But if you're going to insist on podsixnet, you may not have a choice.After reading their code I would never use this package.  My other idea is: learn asyncore and asynchat, or learn asyncio, and write your own.  You're not doing fancy UDP stuff (and neither is podsixnet, much to my disappointment), and there are more "here's how you write a network protocol that splits a tcp connection into lines/messages" tutorials out there than I can count, for any networking framework you could choose.I think that the lesson for you here, and also perhaps the lesson for whoever you're working with, is that when using unpopular, barely documented libraries you have to know enough about what's going on underneath to read them to make up for documentation deficiencies or to figure out if what you're doing is to blame.  In this case I think this ends at you needing to know enough asyncore and asynchat to read it and figure out how it works.  That doesn't render the library useless--it's almost always easier to fix it than to build from scratch.  My first "I don't touch this" heuristic, though, is if it uses global variables, and I think that you don't need me to explain further why that's on my list of run away from this library heuristics.If I had something better, in terms of being easy, I'd offer it.  I might in 6 months.  But in general if you're going to end up using a TCP library you should just use a proper TCP library, any of the mature Python options.  Podsixnet style abstractions are great if you're dealing with UDP but there's lots of stuff that'll share the main game loop fine, in fact podsixnet uses built-in Python modules that do exactly that to work in the first place.

URL: https://forum.audiogames.net/post/550052/#p550052




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Proper disconnection with Podsixnet?

2020-07-08 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Proper disconnection with Podsixnet?

So an update.We fixed the issues with connection, but we gained a whole bucket of new problems in the process.Not calling connection.close causes the following scenarios to occur.1. I log in. Everyone gets alerted that I am online.2. I press escape and everyone else still thinks that I am online.3. I reconnect to the server and everyone sees something like this:"Amerikranian went offline""Amerikranian comes online"All of this occurs back to back, which is incorrect. The server should be alerted to the fact of me going offline as soon as I press escape.When we try and call connection.close() in the Network_disconnected function, which we call in order to initiate the disconnection process, we get the following error:"Local variable 'connection' referenced before assignment"Typing global connection at the top of the Network_disconnected function fixes this and causes others to see the correct online / offline alerts, but now we are back to square one -- inability to connect after returning to the main menu.The function looks like this (Only relevant code parts)from PodSixNet.Connection import connection
from PodSixNet.EndPoint import EndPoint
class Client(EndPoint):
def Network_disconnected(self):
global connection
connection.Close()
connection = EndPoint()The scenario I described earlier with the delayed server alerts looks very similar, just without the connection.Close line. Removing the global statement causes the local variable error.We have tried to replace any references to connection with a newly-created object, like this:class Client(ConnectionListener):
def __init__(self):
self.connection = EndPoint()
#...The client does not work at all. Period. No connection, nothing happens.Any more ideas?

URL: https://forum.audiogames.net/post/550034/#p550034




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Proper disconnection with Podsixnet?

2020-07-08 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Proper disconnection with Podsixnet?

So an update.We fixed the issues with connection, but we gained a whole bucket of new ones in the process.Not calling connection.close causes the following scenarios to occur.1. I log in. Everyone gets alerted that I am online.2. I press escape and everyone else still thinks that I am online.3. I reconnect to the server and everyone sees something like this:"Amerikranian went offline""Amerikranian comes online"All of this occurs back to back, which is incorrect. The server should be alerted to the fact of me going offline as soon as I press escape.When we try and call connection.close() in the Network_disconnected function, which we call in order to initiate the disconnection process, we get the following error:"Local variable 'connection' referenced before assignment"Typing global connection at the top of the Network_disconnected function fixes this and causes others to see the correct online / offline alerts, but now we are back to square one -- inability to connect after returning to the main menu.The function looks like this (Only relevant code parts)from PodSixNet.Connection import connection
from PodSixNet.EndPoint import EndPoint
class Client(EndPoint):
def Network_disconnected(self):
global connection
connection.Close()
connection = EndPoint()The scenario I described earlier with the delayed server alerts looks very similar, just without the connection.Close line. Removing the global statement causes the local variable error.We have tried to replace any references to connection with a newly-created object, like this:class Client(ConnectionListener):
def __init__(self):
self.connection = EndPoint()
#...The client does not work at all. Period. No connection, nothing happens.Any more ideas?

URL: https://forum.audiogames.net/post/550034/#p550034




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Proper disconnection with Podsixnet?

2020-07-07 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Proper disconnection with Podsixnet?

Replacing the connection did work, thank you. We had to give up on calling connection.close() and replaced the old instance with a new one.

URL: https://forum.audiogames.net/post/549831/#p549831




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Proper disconnection with Podsixnet?

2020-07-07 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Re: Proper disconnection with Podsixnet?

Thank you. If someone else has any ideas I'm open to hearing them, but as of right now I will do what you suggested. Appreciate the response.

URL: https://forum.audiogames.net/post/549640/#p549640




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Proper disconnection with Podsixnet?

2020-07-07 Thread AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector


  


Re: Proper disconnection with Podsixnet?

I looked out of curiosity because podsixnet is surely, surely UDP and I vaguely wondered what it's using.  But actually no it's TCP.  And more to the point it looks like connection is a singleton, which is kinda braindead.  But if you just import the module (not the item in the module, the module itself) you can probably replace that singleton after a disconnect and be all right.  Docstrings suggest you can use EndPoint yourself instead of the connection singleton.  That may be what you want.  The code is something you should be able to find your way around in, it's just using asyncore and asynchat.perhaps someone has a better answer and can give you magic lines of code.

URL: https://forum.audiogames.net/post/549638/#p549638




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Proper disconnection with Podsixnet?

2020-07-07 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Proper disconnection with Podsixnet?

Recently one of my friends attempted to use the previously mentioned culprit. He managed to edit the chat client example and give it a proper window using Lucia. However, he has encountered an issue: If the server errors out and the client disconnects, there is no way to reconnect back to the server without restarting the client. We have verified that the server sees the connection, but that is it. As soon as the server detects the client attempting to reconnect, the client strangely drops its connection. The modified example was based off of this client and this serverHere is what we have tried:Whenever the Network_disconnected gets called, call connection.close(). This is the closest thing we have found to any type of disconnect method. Connection.py, found here, where we get ConnectionListener and connection from does not have any functions with the disconnect purpose. This does not work.Sending the packet from the server to disconnect the client. This does not work, either.Not calling connection.close. Does not work.I remember fixing this some 8 or so months ago, I just can't remember what I did, exactly, and we have tried literally everything we could think of.I would appreciate some times and or suggestions on this issue.

URL: https://forum.audiogames.net/post/549632/#p549632




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Proper disconnection with Podsixnet?

2020-07-07 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Proper disconnection with Podsixnet?

Recently one of my friends attempted to use the previously mentioned culprit. He managed to edit the chat client example and give it a proper window using Lucia. However, he has encountered an issue: If the server errors out and the client disconnects, there is no way to reconnect back to the server without restarting the client. We have verified that the server sees the connection, but that is it. As soon as the server detects the client attempting to reconnect, the client strangely drops its connection. The modified example was based off of this client and this serverHere is what we have tried:Whenever the Network_disconnected gets called, call connection.close(). This is the closest thing we have found to any type of disconnect method. Connection.py, found here, where we get ConnectionListener and connection from does not have any functions with the disconnect purpose. This does not work.Sending the packet from the server to disconnect the client. This does not work, either.Not calling connection.close. Does not work.I remember fixing this some 8 or so months ago, I just can't remember what I did, exactly, and we have tried literally everything.I would appreciate some times and or suggestions on this issue.

URL: https://forum.audiogames.net/post/549632/#p549632




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Proper disconnection with Podsixnet?

2020-07-07 Thread AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector


  


Proper disconnection with Podsixnet?

Recently one of my friends attempted to use the previously mentioned culprit. He managed to edit the chat client example and give it a proper window using Lucia. However, he has encountered an issue: If the server errors out and the client disconnects, there is no way to reconnect back to the server without restarting the client. We have verified that the server sees the connection, but that is it. As soon as the server detects the client attempting to reconnect, the client strangely drops its connection. The modified example was based off of this client and this serverHere is what we have tried:Whenever the Network_disconnected gets called, call connection.close(). This is the closest thing we have found to any type of disconnect method. Connection.py, found here, where we get ConnectionListener and connection from does not have any functions with the disconnect purpose. This does not work.Sending the packet from the server to disconnect the client. This does not work, either.I remember fixing this some 8 or so months ago, I just can't remember what I did, exactly, and we have tried literally everything.I would appreciate some times and or suggestions on this issue.

URL: https://forum.audiogames.net/post/549632/#p549632




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector