network question

Hey everyone, just a quick question to all the blender network people.

Im try to use the blender engine to be the server instead of a python script, the only problem is the command ‘socket.accept()’. It is a blocking network command which freezes the server until someone connects.

Do you know another way/command to accept clients without the blocking?

hi bull-frog,

I just started to look into sockets a few days ago, so I am not sure if I really can help. But as you said “blocking”, the socket.setblocking() method came to my mind. I think it is used for recv() and send(), but maybe you could try it. 1 and 0 are the possible flags.
Another thing I just thought of is the socket.setsockopt() method. There are several option you can set this way, maybe one of them helps you. I am sorry that I cannot provide a link to the options and thier documentation.

Good luck!

Thanks Quen, I will look further into your information.

Hi bull-frog,

what do you mean with

Are you coding the BGE directly in C/C++?

I cannot really answer your question, but you can use the accept() within a thread. That means the thread is blocked not the main process.

Hi Monster, I am using the in game python text editor along with logic blocks to create my network server. It makes it a lot more easier to make a server controlled network game when you can see whats happening in the server in real time 3d.

Good news is I got everything to work with the commands ‘socket.setblocking(0)’ and ‘socket.listen(5)’. So its all go! thanks quen for your help

Interesting with the thread, I had no idea you could do that! This will definitely help me in finishing this project! Thanks Monster