Error 10048 when trying to open TcpChannel

2019-07-31 02:28发布

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

I use the simplest code from 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.

What am I doing wrong?

4条回答
我只想做你的唯一
2楼-- · 2019-07-31 02:41

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.

Two simple Windows commands solved the problem:

netsh int ip reset resetlog.txt

netsh winsock reset

查看更多
乱世女痞
3楼-- · 2019-07-31 02:58

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.

查看更多
该账号已被封号
4楼-- · 2019-07-31 02:59

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.

查看更多
萌系小妹纸
5楼-- · 2019-07-31 02:59

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

查看更多
登录 后发表回答