예제 #1
0
 public SocketPacket createPacket(SOCKET_PACKET type)
 {
     if (mSocketPacketTypeList.ContainsKey(type))
     {
         PacketInfo info = mSocketPacketTypeList[type];
         return(UnityUtility.createInstance <SocketPacket>(mSocketPacketTypeList[type].mClassType, info.mType, info.mDataCount));
     }
     return(null);
 }
예제 #2
0
    protected bool updateUdpServer()
    {
        IPEndPoint endpoint = new IPEndPoint(IPAddress.Any, 0);
        EndPoint   ep       = (EndPoint)endpoint;

        byte[] recBuff = new byte[mMaxReceiveCount];
        if (mServerSoket == null)
        {
            return(false);
        }
        int intReceiveLength = mServerSoket.ReceiveFrom(recBuff, ref ep);

        if (intReceiveLength > 0)
        {
            SOCKET_PACKET spType = mSocketFactory.getSocketType(recBuff, intReceiveLength);
            receivePacket(spType, recBuff, intReceiveLength);
        }
        return(true);
    }
예제 #3
0
 public SocketPacket(SOCKET_PACKET type, int dataCount)
 {
     mType      = type;
     mDataCount = dataCount;
 }
예제 #4
0
 public SocketPacketFrictionRet(SOCKET_PACKET type, int dataCount)
     :
     base(type, dataCount)
 {
 }
예제 #5
0
 public PacketInfo(SOCKET_PACKET type, Type classType, int dataCount)
 {
     mType      = type;
     mClassType = classType;
     mDataCount = dataCount;
 }
예제 #6
0
    //-------------------------------------------------------------------------------------------------------------------------------
    protected void registerPacket <T>(SOCKET_PACKET type, int dataCount)
    {
        PacketInfo info = new PacketInfo(type, typeof(T), dataCount);

        mSocketPacketTypeList.Add(type, info);
    }
예제 #7
0
 public int getPacketSize(SOCKET_PACKET type)
 {
     return(mSocketPacketTypeList[type].mDataCount);
 }
예제 #8
0
 public SocketPacketSpeedDataRet(SOCKET_PACKET type, int dataCount)
     :
     base(type, dataCount)
 {
 }
예제 #9
0
 public INPUT_ELEMENT(SOCKET_PACKET type, byte[] data, int dataSize)
 {
     mType     = type;
     mData     = data;
     mDataSize = dataSize;
 }
예제 #10
0
 protected void receivePacket(SOCKET_PACKET type, byte[] data, int dataSize)
 {
     mInputLock.waitForUnlock();
     mRecieveList.Add(new INPUT_ELEMENT(type, data, dataSize));
     mInputLock.unlock();
 }
예제 #11
0
 public SocketPacket createPacket(SOCKET_PACKET type)
 {
     return(mSocketFactory.createPacket(type));
 }