标题: unity3D Socket连接C# 服务器出现怪了 [打印本页] 作者: star-小虎 时间: 2013-10-30 16:52 标题: unity3D Socket连接C# 服务器出现怪了 unity3D Socket与C#服务器第一次连接时通讯正常,客服端段关闭后,unity3D编辑器再次启动连接 unity3D编辑器立即卡死,但是C#服务器与AS3Socket客服端多次连接就正常,大家帮帮,在下感激不敬。一直没找到unity3D 和C#服务器通讯的框架,大家有什么好推荐的
客服端 unity3D 代码:using UnityEngine;
using System.Collections;
using System.Net.Sockets;
using System.Net;
using System.Threading;
using System.Text;
using System;
using System.IO;
using System.Runtime.Remoting.Messaging;
public class NewBehaviourScript : MonoBehaviour
{
// Use this for initialization
private Socket socket = null;
private int i = 0;
private NetworkStream networkStream;
private TcpClient tcpClient;
void Start()
{
initSocket();
}
// Update is called once per frame
void Update()
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
using System.Net.Sockets;
using System.Net;
using System.IO;
using System.Threading;
using System.Collections;
using System.Runtime.Remoting.Messaging;
namespace WebApplication5
{
public partial class _Default : System.Web.UI.Page
{
private static int i = 0;
private static Socket socket;
private TcpListener tcpLister;
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack) return;
begin();
}
void test()
{
bool live = true;
while (live)
{
try
{
if (tcpLister.Pending())
{