Example #1
0
        static public SocketHelper GetInstance()
        {
            if (instance_ == null)
            {
                instance_ = new SocketHelper();
            }

            return(instance_);
        }
Example #2
0
        private void InitSocket()
        {
            this.udpRemote_ = new IPEndPoint(IPAddress.Broadcast, REMOTE_PORT);
            IPEndPoint ip = new IPEndPoint(IPAddress.Any, BIND_PORT);

            this.udp_ = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
            this.udp_.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.Broadcast, 1);
            try
            {
                this.udp_.Bind(ip);
                SocketHelper.GetInstance().Register(this);
            } catch (SocketException e)
            {
            }
        }
Example #3
0
 public ISocket()
 {
     SocketHelper.GetInstance().recvHandle_ +=
         new SocketHelper.RecvSignalHandle(RecvSignaled);
 }