views:

711

answers:

4

Hello!

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?

+1  A: 

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

A: 

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.

casperOne
A: 

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.

A: 

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