尝试打开TcpChannel时出现错误10048

时间:2022-01-29 15:46:20

I'm pretty inexperienced in Remoting. I'm trying to use it and keep receiving WinSock error 10048 when opening TcpChannel.

我对Remoting很缺乏经验。我正在尝试使用它并在打开TcpChannel时继续收到WinSock错误10048。

I use the simplest code from MSDN:

我使用MSDN中最简单的代码:

    TcpChannel serverChannel = new TcpChannel(9090);
    ChannelServices.RegisterChannel(serverChannel);
    RemotingConfiguration.RegisterWellKnownServiceType(
        typeof(RemoteObject), "RemoteObject.rem", 
        WellKnownObjectMode.Singleton);

When ran for the first time, it work and quit correctly, but for second and so on I keep receiving error 10048, like socket 9090 is already in use. Netstat -a do not show port 9090 at all, like it was closed already.

当第一次运行时,它正常工作并退出,但是对于第二次等等,我一直收到错误10048,就像套接字9090已经在使用中一样。 Netstat -a根本没有显示端口9090,就像它已经关闭一样。

What am I doing wrong?

我究竟做错了什么?

4 个解决方案

#1


Prior to asking here I've spent four days trying to solve this, and already here's an answer: it's just WinSock in Windows XP was corrupted.

在问这里之前我花了四天时间试图解决这个问题,而且已经有了答案:它只是Windows XP中的WinSock已损坏。

Two simple Windows commands solved the problem:

两个简单的Windows命令解决了这个问题:

netsh int ip reset resetlog.txt

netsh int ip reset resetlog.txt

netsh winsock reset

netsh winsock重置

#2


Error 10048 corresponds to WSAEADDRINUSE, which means that the address is in use already. From what I can tell, it would most likely mean that port 9090 is already taken by another application.

错误10048对应于WSAEADDRINUSE,这意味着该地址已在使用中。据我所知,这很可能意味着端口9090已被另一个应用程序占用。

#3


Yes, of course. Problem was that there wasn't any applications using that port (at least visible by netstat). I've tried many other ports like 39000, 9095 and so on, with exactly same results.

当然是。问题是没有任何应用程序使用该端口(至少可以通过netstat看到)。我尝试了许多其他端口,如39000,9095等,结果完全相同。

#4


I suspect ISA Server Firewall Client may sometimes cause that kind of behaviour.

我怀疑ISA Server防火墙客户端有时可能会导致这种行为。

#1


Prior to asking here I've spent four days trying to solve this, and already here's an answer: it's just WinSock in Windows XP was corrupted.

在问这里之前我花了四天时间试图解决这个问题,而且已经有了答案:它只是Windows XP中的WinSock已损坏。

Two simple Windows commands solved the problem:

两个简单的Windows命令解决了这个问题:

netsh int ip reset resetlog.txt

netsh int ip reset resetlog.txt

netsh winsock reset

netsh winsock重置

#2


Error 10048 corresponds to WSAEADDRINUSE, which means that the address is in use already. From what I can tell, it would most likely mean that port 9090 is already taken by another application.

错误10048对应于WSAEADDRINUSE,这意味着该地址已在使用中。据我所知,这很可能意味着端口9090已被另一个应用程序占用。

#3


Yes, of course. Problem was that there wasn't any applications using that port (at least visible by netstat). I've tried many other ports like 39000, 9095 and so on, with exactly same results.

当然是。问题是没有任何应用程序使用该端口(至少可以通过netstat看到)。我尝试了许多其他端口,如39000,9095等,结果完全相同。

#4


I suspect ISA Server Firewall Client may sometimes cause that kind of behaviour.

我怀疑ISA Server防火墙客户端有时可能会导致这种行为。