Comments (11)
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.
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.
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.
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.
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.
No i have tried on local machine (between python and unity and that is working)
from unity3d-python-communication.
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.
- Who is the server? Docker or your local host?
- Which side is not receiving the message?
- Did you try to run one simple python process on local host and another simple python process (Not jupyter) on your docker?
- 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.
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.
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.
Thanks for your all suggestions!
from unity3d-python-communication.
Related Issues (20)
- Python to Unity HOT 5
- There were some problems when I opened your project in Unity3D HOT 5
- Can this be used for communication between 2 pc? HOT 3
- Trying to understand the reason for using both threading and non-blocking TryReceiveFrameString HOT 3
- 'Lazy Pirate' Reliability pattern HOT 1
- Sending message based on button press HOT 4
- Sending Frames from Unity to Python HOT 6
- server.py stuck on thread HOT 9
- Sending Images from Unity to Python HOT 2
- How to extract messages from RunAbleThread to monobehaviour? HOT 1
- Client just stops receiving stuff after ~30 seconds HOT 2
- I've written nice article based on your code
- Unity-Python communication (the python client is running in the browser) HOT 2
- Can it send different info to different clients? HOT 6
- About send pictures HOT 1
- about broadcast message HOT 2
- connect SUMO to Unity3D HOT 1
- how to send vector3 list from unity to python HOT 1
- Communication stops HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from unity3d-python-communication.