Click here to Skip to main content
16,018,637 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi,
I am using remoting to access function in another program some time Dot net throwing an erorr (A non-blocking socket operation could not be completed immediately)
how can i solve this problem pls help. .

server side code
C#
public string IsServerActive()
     {
         return "SUCCESS";
     }


client side code

C#
private bool IsServerExists(string ServerIP, string ServerPort)
    {
        try
        {
            bool connectionStatus = false;
            ChannelServices.RegisterChannel(new TcpClientChannel(),false);
            Type requiredType = typeof(IServerInterface);
           IServerInterface gblRemoteObject  = (IServerInterface)Activator.GetObject(requiredType, "tcp://" + ServerIP + ":" + ServerPort + "/ServerRequest");
            if (gblRemoteObject.IsServerActive().Trim() == "SUCCESS")
                connectionStatus = true;
            return connectionStatus;
        }
        catch
        {
            return false;
        }
 
    }
Posted
Updated 4-Jul-11 22:44pm
v2
Comments
Sergey Alexandrovich Kryukov 4-Jul-11 18:28pm    
Can be different reasons, needs code.
--SA

1 solution

You haven't shown any code here so I'm going to have to guess what you've got, but I suspect the issue is in a synchronous call to Connect on a non blocking socket. Rather than using it synchronously, I tend to prefer to use BeginConnect/EndConnect instead.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900