阻止未经授权的TCP客户端

时间:2014-09-11 13:20:58

标签: c# security tcp handshake

我是C#的新手,我想知道是否可以使用一种机制来检查授权,类似于TCP客户端如何在其握手数据包中发送解密密码。如果没有,我如何防止未经授权的客户端连接到我的TCP服务器?

下面的代码显示了我接受每个客户端的位置,并将它们保存在TCPClientObject数组中以供日后使用:

private void startTcpClientAccept()
{
    while (true)
    {
        TCPClientObject temp = new TCPClientObject();
        temp.setIndex(availableIndexes.Dequeue());
        temp.setClient(server.AcceptTcpClient());

        //I need the check mecanism here. before receiving any messages
        clientList[temp.getIndex()] = temp;

        Console.WriteLine("GSM Client is accepted");
     }
}

基本上,问题是任何人都可以连接到服务器,这可能会进一步造成一些安全问题。

0 个答案:

没有答案