GetBroadcastConnectionInfo() private method

private GetBroadcastConnectionInfo ( int hostId, int &port, byte &error ) : string
hostId int
port int
error byte
return string
コード例 #1
0
 private void Update()
 {
     if ((this.m_HostId != -1) && !this.m_IsServer)
     {
         NetworkEventType type;
         do
         {
             int  num;
             int  num2;
             int  num3;
             byte num4;
             type = NetworkTransport.ReceiveFromHost(this.m_HostId, out num, out num2, this.m_MsgInBuffer, 0x400, out num3, out num4);
             if (type == NetworkEventType.BroadcastEvent)
             {
                 string str;
                 int    num5;
                 NetworkTransport.GetBroadcastConnectionMessage(this.m_HostId, this.m_MsgInBuffer, 0x400, out num3, out num4);
                 NetworkTransport.GetBroadcastConnectionInfo(this.m_HostId, out str, out num5, out num4);
                 NetworkBroadcastResult result = new NetworkBroadcastResult {
                     serverAddress = str,
                     broadcastData = new byte[num3]
                 };
                 Buffer.BlockCopy(this.m_MsgInBuffer, 0, result.broadcastData, 0, num3);
                 this.m_BroadcastsReceived[str] = result;
                 this.OnReceivedBroadcast(str, BytesToString(this.m_MsgInBuffer));
             }
         }while (type != NetworkEventType.Nothing);
     }
 }
コード例 #2
0
        private void Update()
        {
            if (this.m_HostId == -1 || this.m_IsServer)
            {
                return;
            }
            NetworkEventType fromHost;

            do
            {
                int  connectionId;
                int  channelId;
                int  receivedSize;
                byte error;
                fromHost = NetworkTransport.ReceiveFromHost(this.m_HostId, out connectionId, out channelId, this.m_MsgInBuffer, 1024, out receivedSize, out error);
                if (fromHost == NetworkEventType.BroadcastEvent)
                {
                    NetworkTransport.GetBroadcastConnectionMessage(this.m_HostId, this.m_MsgInBuffer, 1024, out receivedSize, out error);
                    string address;
                    int    port;
                    NetworkTransport.GetBroadcastConnectionInfo(this.m_HostId, out address, out port, out error);
                    NetworkBroadcastResult networkBroadcastResult = new NetworkBroadcastResult();
                    networkBroadcastResult.serverAddress = address;
                    networkBroadcastResult.broadcastData = new byte[receivedSize];
                    Buffer.BlockCopy((Array)this.m_MsgInBuffer, 0, (Array)networkBroadcastResult.broadcastData, 0, receivedSize);
                    this.m_BroadcastsReceived[address] = networkBroadcastResult;
                    this.OnReceivedBroadcast(address, NetworkDiscovery.BytesToString(this.m_MsgInBuffer));
                }
            }while (fromHost != NetworkEventType.Nothing);
        }
コード例 #3
0
        private void Update()
        {
            if (this.m_HostId == -1)
            {
                return;
            }
            if (this.m_IsServer)
            {
                return;
            }
            NetworkEventType networkEventType;

            do
            {
                int  num;
                int  num2;
                int  num3;
                byte b;
                networkEventType = NetworkTransport.ReceiveFromHost(this.m_HostId, out num, out num2, this.m_MsgInBuffer, 1024, out num3, out b);
                if (networkEventType == NetworkEventType.BroadcastEvent)
                {
                    NetworkTransport.GetBroadcastConnectionMessage(this.m_HostId, this.m_MsgInBuffer, 1024, out num3, out b);
                    string text;
                    int    num4;
                    NetworkTransport.GetBroadcastConnectionInfo(this.m_HostId, out text, out num4, out b);
                    NetworkBroadcastResult value = default(NetworkBroadcastResult);
                    value.serverAddress = text;
                    value.broadcastData = new byte[num3];
                    Buffer.BlockCopy(this.m_MsgInBuffer, 0, value.broadcastData, 0, num3);
                    this.m_BroadcastsReceived[text] = value;
                    this.OnReceivedBroadcast(text, NetworkDiscovery.BytesToString(this.m_MsgInBuffer));
                }
            }while (networkEventType != NetworkEventType.Nothing);
        }
コード例 #4
0
        void Update()
        {
            if (m_HostId == -1)
            {
                return;
            }

            if (m_IsServer)
            {
                return;
            }

            NetworkEventType networkEvent;

            do
            {
                int  connectionId;
                int  channelId;
                int  receivedSize;
                byte error;
                networkEvent = NetworkTransport.ReceiveFromHost(m_HostId, out connectionId, out channelId, m_MsgInBuffer, k_MaxBroadcastMsgSize, out receivedSize, out error);

                if (networkEvent == NetworkEventType.BroadcastEvent)
                {
                    //ブロードキャストのメッセージを取得
                    NetworkTransport.GetBroadcastConnectionMessage(m_HostId, m_MsgInBuffer, k_MaxBroadcastMsgSize, out receivedSize, out error);

                    string senderAddr;
                    int    senderPort;
                    //接続情報を取得
                    NetworkTransport.GetBroadcastConnectionInfo(m_HostId, out senderAddr, out senderPort, out error);
                    //NetworkBroadcastResult変数にアドレスとメッセージを代入
                    var recv = new NetworkBroadcastResult();
                    recv.serverAddress = senderAddr;
                    recv.broadcastData = new byte[receivedSize];
                    Buffer.BlockCopy(m_MsgInBuffer, 0, recv.broadcastData, 0, receivedSize);
                    //見つかった部屋を登録
                    m_BroadcastsReceived[senderAddr] = recv;
                    if (RoomList.roomListAddress.Contains(senderAddr) == false)
                    {
                        OnReceivedBroadcast(senderAddr, BytesToString(m_MsgInBuffer));
                    }
                }
            }while (networkEvent != NetworkEventType.Nothing);
        }
コード例 #5
0
        void Update()
        {
            if (m_HostId == -1)
            {
                return;
            }

            if (m_IsServer)
            {
                return;
            }

            NetworkEventType networkEvent;

            do
            {
                int  connectionId;
                int  channelId;
                int  receivedSize;
                byte error;
                networkEvent = NetworkTransport.ReceiveFromHost(m_HostId, out connectionId, out channelId, m_MsgInBuffer, k_MaxBroadcastMsgSize, out receivedSize, out error);

                if (networkEvent == NetworkEventType.BroadcastEvent)
                {
                    NetworkTransport.GetBroadcastConnectionMessage(m_HostId, m_MsgInBuffer, k_MaxBroadcastMsgSize, out receivedSize, out error);

                    string senderAddr;
                    int    senderPort;
                    NetworkTransport.GetBroadcastConnectionInfo(m_HostId, out senderAddr, out senderPort, out error);

                    var recv = new NetworkBroadcastResult();
                    recv.serverAddress = senderAddr;
                    recv.broadcastData = new byte[receivedSize];
                    Buffer.BlockCopy(m_MsgInBuffer, 0, recv.broadcastData, 0, receivedSize);
                    m_BroadcastsReceived[senderAddr] = recv;

                    OnReceivedBroadcast(senderAddr, BytesToString(m_MsgInBuffer));
                }
            }while (networkEvent != NetworkEventType.Nothing);
        }
コード例 #6
0
        private void Update()
        {
            if (m_HostId == -1 || m_IsServer)
            {
                return;
            }
            NetworkEventType networkEventType;

            do
            {
                networkEventType = NetworkTransport.ReceiveFromHost(m_HostId, out int _, out int _, m_MsgInBuffer, 1024, out int receivedSize, out byte error);
                if (networkEventType == NetworkEventType.BroadcastEvent)
                {
                    NetworkTransport.GetBroadcastConnectionMessage(m_HostId, m_MsgInBuffer, 1024, out receivedSize, out error);
                    NetworkTransport.GetBroadcastConnectionInfo(m_HostId, out string address, out int _, out error);
                    NetworkBroadcastResult value = default(NetworkBroadcastResult);
                    value.serverAddress = address;
                    value.broadcastData = new byte[receivedSize];
                    Buffer.BlockCopy(m_MsgInBuffer, 0, value.broadcastData, 0, receivedSize);
                    m_BroadcastsReceived[address] = value;
                    OnReceivedBroadcast(address, BytesToString(m_MsgInBuffer));
                }
            }while (networkEventType != NetworkEventType.Nothing);
        }
コード例 #7
0
 public static void GetBroadcastConnectionInfo(int hostId, out string address, out int port, out byte error)
 {
     address = NetworkTransport.GetBroadcastConnectionInfo(hostId, out port, out error);
 }