GithubHelp home page GithubHelp logo

Comments (11)

offchan42 avatar offchan42 commented on May 24, 2024

This is a general networking question about ZeroMQ.
ZeroMQ doesn't care where you run your code. As long as both your processes (python server) and unity are communicating on the same port and they can see each other it will work.
If it's not working, you probably done some bugs. you need to debug it by producing minimal working code first.
Try communicating between your Jupyter process and another python process.
By the way, it's not a good idea to run a server on Jupyter notebook.

from unity3d-python-communication.

Vishav3 avatar Vishav3 commented on May 24, 2024

I am very new to networking stuff. Your guidance will be helpful. There is no error showing up on either side but also communication is not happening.

from unity3d-python-communication.

offchan42 avatar offchan42 commented on May 24, 2024

If communication is not happening, you need to tell me exactly which line of code is not performing what it needs to do. Print everything. With the information you gave me I have no exact idea to tell you what to do. My guidance is to suggest you to learn basic zeromq first and you will be able to debug on your own. when you ask questions you need to be very specific in order to get answer quickly without back and forth answering.

You haven't done that maybe because you don't know it at all, so The official tutorial with no more than 10 lines of code will help you.
By default I've already set the port of the server and client the same, so no need to change.
But I'm not asking you to change, I'm asking you to create a new python client to replace unity. This is to see why it's not communicating by producing minimal working code first. Please learn ZeroMQ tutorial. You will see that it's very easy.

from unity3d-python-communication.

Vishav3 avatar Vishav3 commented on May 24, 2024

To explain the scenario. This is my Unity scene. Here the unity is sending message:

And this is where I am using python code in Jupyter notebook. But the script keep running without receiving message.

I would like to add that the notebook is running inside the docker container of the server. And could be please share the link of ZeroMQ tutorial you are refering to?

from unity3d-python-communication.

offchan42 avatar offchan42 commented on May 24, 2024

It's just official guide https://zguide.zeromq.org/

  • have you tried without Jupyter notebook?
  • please try to produce minimal working code that communicates between 2 python processes. Don't use unity. This becomes problem about docker networking stuff now. Which I guess is about setting the port properly when your call docker run command. But you should know this better because I don't know. If you don't know you need to learn how docker communicates with the external app.

Again, it's better solved by minimal working code. Debug it. I don't know the answer right away.

from unity3d-python-communication.

Vishav3 avatar Vishav3 commented on May 24, 2024

No i have tried on local machine (between python and unity and that is working)
image

from unity3d-python-communication.

Vishav3 avatar Vishav3 commented on May 24, 2024

I tried minimal working code that communicates between 2 python processes. Yes it works well! But python is not communicating with docker container. The code stops at receiving message. The port is configured properly when i call docker run command.

from unity3d-python-communication.

offchan42 avatar offchan42 commented on May 24, 2024
  1. Who is the server? Docker or your local host?
  2. Which side is not receiving the message?
  3. Did you try to run one simple python process on local host and another simple python process (Not jupyter) on your docker?
  4. How do people usually communicate TCP between local host and docker? Try that method first before ZeroMQ. Because ZeroMQ is just a higher abstraction on TCP. If TCP works, so does ZeroMQ.

from unity3d-python-communication.

Vishav3 avatar Vishav3 commented on May 24, 2024

Sorry for asking so many things. The things are more complexed. But for simplicity, keep the docker container/Jupyter notebook aside. I just want to communicate between local host (i.e. my laptop using python) and webbrowser (i.e. python interpreter running). How can I do that using TCP communication?
This is browser side

This is on my local machine

But i am getting connection refused error. I am not understanding how to communicate between browser and laptop using TCP?
I need to make a persistent connection between a web browser and my python script.

from unity3d-python-communication.

offchan42 avatar offchan42 commented on May 24, 2024

First of all, don't call that as running python from the browser. You are running Python process on someone else's computer server. The browser is irrelevant to the equation.
Better call it as running python from an online IDE.

Second, we cannot know whether the online IDE blocks the connection to the outside world or not. They can disallow you to create arbitrary sockets if they want.

Third, create such TCP sockets on your machine and test 2 python processes first both in your machine. If it works and it doesn't work on that online IDE then they don't allow you to do it. There are many problems that could happen with networking e.g. firewall blocking, wrong IP address identification, etc. I cannot debug all that for you through this kind of back and forth messaging. Because even if it's team viewer and video call it will still take some time to debug it. You have to learn to do it yourself. That error message is very good point to Google and learn about all the possible causes for it to happen.

Fourth, why are you trying to use an online IDE to connect to your unity client? Maybe you should try use another local computer as a server first?

I'm also not Pro at communication between 2 machines via networking, so you will have to debug it. This example repo is showing you how to communicate in one machine only. But it definitely can scale to any number of machines.

Google how to communicate between python processes on different computer using python and go through that rabbit hole yourself.

from unity3d-python-communication.

Vishav3 avatar Vishav3 commented on May 24, 2024

Thanks for your all suggestions!

from unity3d-python-communication.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.