// Golang Server

package main

import (
    "net/http"
    "fmt"
)

func loadin(w http.ResponseWriter, r *http.Request) {
    username := r.FormValue("username")
    password := r.FormValue("password")
    fmt.Fprintf(w,"<html><body>");
    fmt.Fprintf(w, "Hello, %s ! <br/>", username)
    fmt.Fprintf(w, "Your password is : %s!", password)
    fmt.Fprintf(w,"</body></html>");
}

func main() {
    http.HandleFunc("/loadin", loadin)
    http.ListenAndServe(":8080", nil)
}

 
// Unity C#

using UnityEngine;
using System.Collections;

public class NewBehaviourScript : MonoBehaviour {

    IEnumerator Start () {
        WWWForm wwwF = new WWWForm ();
        wwwF.AddField ("username","Loli");
        wwwF.AddField ("password","Kitty");
        WWW www = new WWW ("http://127.0.0.1:8080/loadin", wwwF);
        yield return www;
        print (www.text);
    }
}

執行結果:

Unity - A.unity - New Unity Project 3 - Android DX11 on DX9 GPU  









arrow
arrow
    全站熱搜

    黃彥霖 發表在 痞客邦 留言(0) 人氣()