ล็อกแล้ว Socket connection to Cluster IP failed

  • 3 สิงหาคม 2555 3:50
     
     

    I have a cluster with 2 nodes. A TCPListener process is running within each node.   A web application outside the cluster failed to initiate a socket connection using the Cluster IP.  But it has no problem in making connection using the physical IP of the active node.  This is the first time I work on the cluster environment.  Is this a software design issue or a configuration issue on the cluster?

    On the TCPListener application, does it need to program differently if it is running in a cluster?  The applications run fine if it is not in a cluster environment.  Below is the code that initiates the listener

               // Create socket.
                Socket oListenerSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                    
                // Set time to live limit to unlimited.
                oListenerSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.IpTimeToLive, 0);
                    
                // Set socket timeout option.
                this.oListenerSocket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, 15000);
                    
                // Create an IP Endpoint to hook the socket to.
                IPHostEntry lipa = Dns.GetHostEntry(Environment.MachineName);
                IPEndPoint lep = null;
                foreach (IPAddress ip in lipa.AddressList)
                {
                    //
                    // We want the first available IPv4 address (IPv6 not yet supported)
                    //
                    if (ip.AddressFamily == AddressFamily.InterNetwork)
                    {
                        lep = new IPEndPoint(ip, PortNumber);
                        break;
                    }
                }
                if (lep == null)
                {
                    throw new Exception("No valid IPv4 networks on which to listen.");
                }
                    
                // Bind the socket to that port.
                oListenerSocket.Bind(lep);
                    
                // Start listening
                oListenerSocket.Listen(500);
                                   
                // async handler processes connection request.
                oListenerSocket.BeginAccept(new AsyncCallback(AcceptConnection), this.Socket);
               

    Thanks!


    • แก้ไขโดย Jeff KL 3 สิงหาคม 2555 5:23
    •  

ตอบทั้งหมด

  • 3 สิงหาคม 2555 11:01
     
     
    try from DOS window the "Ping Host".  If PIng works, then your code should also work.  If the host name isn't being advertise on the network then you code won't find it and ping also won't find it.  I have a similar problem at work and I haven't had time to figure out yet why the host name isn't being advertised on the network.  I've just been use the IP address right now.  Maybe next week I will try to fix the problem.

    jdweng