我编写了这段代码来搜索文件中的字符串。由于此程序不能用于多个客户端,因此我被要求使用套接字使其更加健壮。我想知道套接字在这个程序中的位置和方式。我还在学习套接字..无法确切地知道它在哪里以及如何使用..有人可以帮助我吗?这是我的计划..
课程计划 {
static void Main(string[] args)
{
if (File.Exists("C://myfile2.txt"))
{
var text = File.ReadAllText("C://myfile2.txt");
foreach (var word in new[] { "and", "so", "not", "c", "to", "by", "has", "do", "behavior", "dance", "france", "ok","that", "please","hello","system","possible","impossible","absolutely","sachin","bradman","schumacher","http","console","application" })
{
var w = word;
new Thread(() => Console.WriteLine("{0}: {1}", w, text.Contains(w) ? "Present" : "Not Present")).Start();
}
}
else
Console.WriteLine("File Does not exist");
Console.ReadLine();
}
}