Skip to main content

 locked
Listen On a Certain Port RRS feed

  • Question

  • I dont know if this is the right place for this.. but lets hope so... Im trying to create a simple... app that will listen on a certain port.. but for some reason It listen.. the program starts but.. then it ends... I also dont get any errors.. So Im a big lost here..

    using System;
    using System.Net;
    using System.Net.Sockets;

    class internetcheck
    {
        public static void Main( )
        {
            new startConnection();
        }
    }

    class startConnection
    {  
       public startConnection( )
       {
        Socket socket = new Socket( AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp );

        IPAddress  ipaddr   = IPAddress.Parse( "127.0.0.1" );
        IPEndPoint endpoint = new IPEndPoint( ipaddr, 888 );
              
        socket.Bind( endpoint );
        socket.Listen(2);
       
        //socket.Close();
       }
    }

    Can anyone see, if they can spot something wrong here.
    Wednesday, January 17, 2007 3:46 PM

Answers

All replies