- Home /
Using WWW class to get multiple responces.
Hello, I found this code
IEnumerator Start() {
WWW www = new WWW(url);
yield return www;
renderer.material.mainTexture = www.texture;
}
And I need to communicate with a sensor that works via ethernet, but gives multiple answers per each request. Is it possible to get all responses from it ?
The WWW class is a simple wrapper around one HTTP request. Per definition, an HTTP request has exactly one response. Are you sure your sensor is talking HTTP?
Yes. WWW talks HTTP, which is based on TCP/IP, but with stuff on top of that. It's like going to a pizza store and ordering a hat. Even though you speak the same language as the vendor, he's gonna be like "what the heck do you want from me?".
You're gonna have to skip using the WWW class (and don't use UnityWebRequest either if you stumble upon it, it only does HTTP as well) and implement the sensor's protocol with directly with TCP on your own. A starting point could be the TCPClient class.
Your answer
Follow this Question
Related Questions
Reliable way to download textures 1 Answer
Upload large files 0 Answers
Is System.Net.HttpWebRequest supported on Android/iOS 1 Answer
WWW.uploadProgress doesn't work on iOS 0 Answers
WWW Resolving host timed out 2 Answers