OpenMetaverse.UDPBase.Start C# (CSharp) Method

Start() public method

public Start ( ) : void
return void
        public void Start()
        {
            if (shutdownFlag)
            {
                if (remoteEndPoint == null)
                {
                    // Server mode

                    // create and bind the socket
                    IPEndPoint ipep = new IPEndPoint(Settings.BIND_ADDR, udpPort);
                    udpSocket = new Socket(
                        AddressFamily.InterNetwork,
                        SocketType.Dgram,
                        ProtocolType.Udp);
                    udpSocket.Bind(ipep);
                }
                else
                {
                    // Client mode
                    IPEndPoint ipep = new IPEndPoint(Settings.BIND_ADDR, udpPort);
                    udpSocket = new Socket(
                        AddressFamily.InterNetwork,
                        SocketType.Dgram,
                        ProtocolType.Udp);
                    udpSocket.Bind(ipep);
                    //udpSocket.Connect(remoteEndPoint);
                }

                // we're not shutting down, we're starting up
                shutdownFlag = false;

                // kick off an async receive.  The Start() method will return, the
                // actual receives will occur asynchronously and will be caught in
                // AsyncEndRecieve().
                AsyncBeginReceive();
            }
        }