在服务器获取到了客户端的ip地址列表代码
using UnityEngine;using System.Collections;
using System.Data;
using Mono.Data.SqliteClient;
public class test : MonoBehaviour {
// Use this for initialization
void Start () {
}
void OnGUI()
{
OpenDB();
}
public void OpenDB()
{
string connection= "URI=file:play.db";
IDbConnection dbcon = (IDbConnection) new SqliteConnection(connection);
IDataReader reader;
dbcon.Open();
IDbCommand dbcmd = dbcon.CreateCommand();
string strsql = "select name,ip " + " from players";
dbcmd.CommandText = strsql;
reader = dbcmd.ExecuteReader();
while(reader.Read()){
string name = reader.GetString(0);
string ip = reader.GetString(1);
GUILayout.Label(name);
GUILayout.Label(ip);
}
reader.Close();
reader = null;
dbcmd.Dispose();
dbcmd = null;
dbcon.Close();
dbcon = null;
}
// Update is called once per frame
void Update () {
}
} {:5_424:}{:5_424:}{:5_424:}{:5_424:} {:soso__3669389859068460655_3:}知道自己发的是什么吗?? 很不错 楼主是超人 真心顶 说的非常好 很好哦 很不错 好帖就是要顶
页:
[1]