|
|
|
using System;
|
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.IO;
|
|
|
|
using System.Net;
|
|
|
|
using System.Text;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
namespace JXSoft {
|
|
|
|
public class HttpServerView : MonoBehaviour
|
|
|
|
{
|
|
|
|
public string[] prefixes;
|
|
|
|
public HttpServerUtility httpServer = new HttpServerUtility();
|
|
|
|
// Start is called before the first frame update
|
|
|
|
void Start()
|
|
|
|
{
|
|
|
|
//httpServer.startServer(prefixes);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Update is called once per frame
|
|
|
|
void Update()
|
|
|
|
{
|
|
|
|
if (httpServer != null && !"".Equals(httpServer.getReceivedValue()))
|
|
|
|
{
|
|
|
|
/*GameObject item = Instantiate(tcpMsgItem, tcpMsgContent);
|
|
|
|
item.GetComponentInChildren<Text>().text = tcpUtil.receivedData;
|
|
|
|
this.GetModel<TCPClientModel>().onDataRecived.Invoke(tcpUtil.receivedData);
|
|
|
|
*/
|
|
|
|
Debug.Log(httpServer.receivedData);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public void startServer() {
|
|
|
|
bool isSuccess = httpServer.startServer(prefixes);
|
|
|
|
Debug.Log("ServerOpen:"+isSuccess);
|
|
|
|
}
|
|
|
|
private void OnDestroy()
|
|
|
|
{
|
|
|
|
httpServer.closeServer();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|