tags:

views:

91

answers:

2

I ran an application on my machine and it ran fine; I then run the apoplication on another machine but I'm getting a socket timeout isse connecting to the box even though Pinging works fine. Below is my socket connection Logic:

        private bool openConnection(out IPEndPoint connection_Point)
    {
        bool connected = false;
        connection_Point = new IPEndPoint(m_address, m_port);
        m_sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
        m_sock.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 1);
        try
        {
            m_sock.Connect(connection_Point);
            connected = true;
        }//end of try logic
        catch (SocketException err)
        {
            connected = false;
            connection_Point = null;
            MessageBox.Show("Socket Exception thrown: " + err);
        }

        return connected;
    }
+1  A: 

Firewall? Sounds like firewall to me...

STW
I'm running (well trying to anyway) on the university network but the machine I'm running it on doesn't have a firewall enabled.
Dark Star1
if possible try taking the school network out of the mix; University's typically have fairly strict network policies to try and cut down on virus outbreaks and other ilk
STW
+2  A: 

ping will only tell if the IP address responds to pings. To confirm that a TCP socket can be opened, try telnet on the listening port from the new machine. If telnet doesn't connect, the likely culprits are firewall and/or IPSec.

Remus Rusanu
I think you are both right.
Dark Star1