using UnityEngine;
using System.Collections;
using System.Text;
public class Network : MonoBehaviour
{
// Use this for initialization
void Start()
{
Debug.Log("[waitforComm] Hello, World!");
string postData = "{\"waitforCommData\":1}";
Hashtable headers = new Hashtable();
headers.Add("Content-Type", "application/json");
byte[] pData = Encoding.ASCII.GetBytes(postData.ToCharArray());
WWW www = new WWW("http://localhost:8080/jspsample/process.jsp", pData, headers);
Debug.Log("[waitforComm] post message requested.");
StartCoroutine(waitforRequest(www));
}
// Update is called once per frame
void Update()
{ }
private IEnumerator waitforRequest(WWW www)
{
yield return www;
Debug.Log("[waitforComm] response : " + www.text);
}
}
dies unser Code ist, kann ich nicht diesen Teil herausUnity Connection auf dem Web von jsp
WWW www = new WWW ("http://localhost:8080/jspsample/process.jsp", pData, headers);
wir haben Fehler in Header, die Argument 3: kann nicht von 'System.Collections.Hashtable' zu
Früher war es "Hashtable" und dieser Code war einmal gültig, aber dann änderte Unity das Argument, um stattdessen 'Dictionary' in der neueren Version zu verwenden. [Merk's] (https://Stackoverflow.com/a/44381316/3785314) Antwort sollte Ihr Problem beheben. – Programmer
@ J.Choi - wenn irgendeine Antwort Ihr Problem gelöst hat, akzeptieren Sie das als Antwort, die anderen helfen wird, die direkte Antwort zu finden und ihre Zeit zu sparen :) –