我正在尝试在 C# 2008 中使用 MSWinSock,但它不起作用。
我不断收到此异常:
System.Runtime.InteropServices.COMException (0x80040112): Het maken van een exemplaar van het COM-onderdeel met CLSID {248DD896-BB45-11CF-9ABC-0080C7E7B78D} uit de IClassFactory is mislukt door de volgende fout: 80040112.
我用这个作为我的代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MSWinsockLib;
using Info.Kernel.Logging;
namespace InfoEmu.Kernel.OldSock
{
public class WinSockListener
{
private WinsockClass Winsock;
private WinsockClass[] Clients = new WinsockClass[1000];
public WinSockListener(int port)
{
try
{
Winsock = new WinsockClass();
Winsock.LocalPort = port;
Winsock.Listen();
}
catch (Exception e)
{
Cout.WriteLine("[ERROR!] {0} {1}", Environment.NewLine, e);
}
}
}
}
找了好久没有好的解决办法。请帮忙。