using UnityEngine;
using System.Collections;
using System.Net.Sockets;
using System.Net;
public class ChatManager : MonoBehaviour {
public string ipaddress = "192.168.51.102";
public int port = 7788;
private Socket clientSocket;
// Use this for initialization
void Start () {
ConnectToServer();
}
// Update is called once per frame
void Update () {
}
void ConnectToServer()
{
clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
// 跟服务器端建立连接
clientSocket.Connect(new IPEndPoint(IPAddress.Parse(ipaddress), port));
}
}