I want to create multiple socket objects and save them in an sqlite database because I dont want to create huge lists of socket objects in my memory. Later(in the same python session) I want to load one socket after another in a var and use it again to send messages and other stuff. Now my Problem is that im not sure how I can serialize and save it in a sqlite db. I tried it with pickling socket as a string object, but it didnt work to well cause i couldnt load it as a socket type object out of the db. Maybe someone knows a better solution?
EDIT:
The issue is now solved. Thanks for all the help of you! What I do now is that immeaditely after accepting new connections, i get the filedescriptor of the conn_socket with socket.fileno() and write it as a string to my sqlite database. Then, when i need the socket I get the filedescriptor value of my db and create the socket with socket.fromfd(). The socket is fully functional and can be created over and over again with this method. So I actually got it to work to not have multiple lists but have one db with all useful stuff of the single connections. BUT the important thing to know is that when I close my pthon program the db is getting deleted because the sockets are getting deleted and closed too. Still it is useful for my case.