有效的方法我的代碼:是不是在給定的情況下
public ChatServer()
{
//create our nickname and nickname by connection variables
nickName = new Hashtable(100);
nickNameByConnect = new Hashtable(100);
//create our TCPListener object
chatServer = new System.Net.Sockets.TcpListener(4296);
//check to see if the server is running
//while (true) do the commands
while (true)
{
chatServer.Start();
if (chatServer.Pending())
{
Chat.Sockets.TcpClient chatConnection = chatServer.AcceptTcpClient();
Console.WriteLine("You Are Connected");
DoCommunicate com = new DoCommunicate(chatConnection);
}
}
}
public static void SendMsgToAll(string nick, string msg)
{
StreamWriter writer;
ArrayList remove = new ArrayList(0);
Chat.Sockets.TcpClient[] tcpClient = new Chat.Sockets.TcpClient[ChatServer.nickName.Count];
ChatServer.nickName.Values.CopyTo(tcpClient, 0);
正如從我上面的代碼中,我們可以看到有2-I-方法II-的ChatServer SendMsgToAll。 所以,當我嘗試寫行Chat.Sockets.TcpClient[] tcpClient = new Chat.Sockets.TcpClient[ChatServer.nickName.Count];
在第二種方法
它提供了以下錯誤:
ChatSerevr()是不是在給定的情況下有效的方法。
我谷歌,但無法找到corrrect解決方案。由於事先
'ChatSerevr()' !='CharServer()'錯字或? –
我不清楚你的評論。你能請精心準備嗎? –
其中,是編譯器會引發該錯誤的行? – aiapatag