예제 #1
0
    public void AddSocket(Socket clientSocket)
    {
        string connectionID = GenerateID();

        while (reciverList.ContainsKey(connectionID))
        {
            connectionID = (int.Parse(connectionID) + 1).ToString();
        }
        NetworkReciver tReciver = new NetworkReciver(connectionID, this, clientSocket, targetServer.AdapterAs <Handles_NetworkServerAdapter>());

        reciverList.Add(connectionID, tReciver);
        targetServer.AdapterAs <Handles_NetworkServerAdapter>().Server_OnClientReciverCreated(tReciver);
        string content = "";

        foreach (string key in reciverList.Keys)
        {
            content += key + "|" + reciverList[key] + ";";
        }
        File.WriteAllText("sockets.txt", content);
    }