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

            return(instance_);
        }
예제 #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)
            {
            }
        }
예제 #3
0
파일: ISocket.cs 프로젝트: thanghoang07/sdk
 public ISocket()
 {
     SocketHelper.GetInstance().recvHandle_ +=
         new SocketHelper.RecvSignalHandle(RecvSignaled);
 }