Ejemplo n.º 1
0
 public StringConnection(
     AipcService aipcService,
     ConnectionAttribute attribute,
     AipcAttribute aipcAttributes,
     Socket socket)
     : base(aipcService, attribute, aipcAttributes, socket)
 { }
Ejemplo n.º 2
0
        public void InitFromListener(ConnectionAttribute connectionAttribute, AipcAttribute aipcAttributes, Socket socket)
        {
            ConnectionAttribute attribute = connectionAttribute.Clone();

            attribute.IsListener = false;
            AipcConnection connection = Create(attribute, aipcAttributes, socket);

            connection.AipcAttributes.Listener = connectionAttribute.HandleNumber;
            connection.MakeCallback("connected", AInteger.Create(connection.AipcAttributes.Listener));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a new <see cref="AipcAttrbiute"/> with default values.
        /// </summary>
        /// <param name="connection">Connection to set on the new <see cref="AipcAttribute"/>.</param>
        /// <returns>Returns the new <see cref="AipcAttriute"/>  with default values.</returns>
        public static AipcAttribute Create(AipcConnection connection)
        {
            AipcAttribute attributes = new AipcAttribute(connection)
            {
                noDelay       = false,
                writePause    = false,
                readPause     = false,
                readPriority  = 0,
                writePriority = 0,
                retry         = false,
                clientData    = Utils.ANull(),
                debug         = false,
                burstMode     = false,
                listener      = 0,
                readBufsize   = 32768,
                writeBufSize  = 32768
            };

            return(attributes);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Create a new <see cref="AipcAttribute"/> from the existing one.
        /// </summary>
        /// <param name="connection">Connection to set on the new <see cref="AipcAttribute"/>.</param>
        /// <returns>Returns the new <see cref="AipcAttriute"/>.</returns>
        public AipcAttribute CreateNew(AipcConnection connection)
        {
            AipcAttribute attributes = new AipcAttribute(connection)
            {
                noDelay       = this.noDelay,
                writePause    = this.writePause,
                readPause     = this.readPause,
                readPriority  = this.readPriority,
                writePriority = this.writePriority,
                retry         = this.retry,
                clientData    = this.clientData,
                debug         = this.debug,
                burstMode     = this.burstMode,
                listener      = this.listener,
                readBufsize   = this.readBufsize,
                writeBufSize  = this.writeBufSize
            };

            return(attributes);
        }
Ejemplo n.º 5
0
        internal AipcConnection(
            AipcService aipcService,
            ConnectionAttribute connectionAttribute,
            AipcAttribute aipcAttribute,
            Socket socket)
        {
            this.aipcService          = aipcService;
            this.connectionAttributes = connectionAttribute;
            this.partialSent          = false;

            if (aipcAttribute != null)
            {
                this.aipcAttributes = aipcAttribute.CreateNew(this);
            }
            else
            {
                this.aipcAttributes = AipcAttribute.Create(this);
            }

            this.Socket = socket;
        }
Ejemplo n.º 6
0
        private AipcConnection Create(ConnectionAttribute connectionAttribute, AipcAttribute aipcAttributes, Socket socket)
        {
            AipcConnection connection;

            switch (connectionAttribute.Protocol.asString)
            {
            case "A":
                connection = new AConnection(this, connectionAttribute, aipcAttributes, socket);
                break;

            case "string":
                connection = new StringConnection(this, connectionAttribute, aipcAttributes, socket);
                break;

            case "raw":
                connection = new RawConnection(this, connectionAttribute, aipcAttributes, socket);
                break;

            case "simple":
                connection = new SimpleConnection(this, connectionAttribute, aipcAttributes, socket);
                break;

            default:
                connectionAttribute.HandleNumber = -1;
                connection = null;
                break;
            }

            if (connectionAttribute.HandleNumber != -1)
            {
                connectionAttribute.HandleNumber = NextHandleNumber();
                AddToRoster(connection);
            }

            return(connection);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Creates a new <see cref="AipcAttrbiute"/> with default values.
        /// </summary>
        /// <param name="connection">Connection to set on the new <see cref="AipcAttribute"/>.</param>
        /// <returns>Returns the new <see cref="AipcAttriute"/>  with default values.</returns>
        public static AipcAttribute Create(AipcConnection connection)
        {
            AipcAttribute attributes = new AipcAttribute(connection)
            {
                noDelay = false,
                writePause = false,
                readPause = false,
                readPriority = 0,
                writePriority = 0,
                retry = false,
                clientData = Utils.ANull(),
                debug = false,
                burstMode = false,
                listener = 0,
                readBufsize = 32768,
                writeBufSize = 32768
            };

            return attributes;
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Create a new <see cref="AipcAttribute"/> from the existing one.
        /// </summary>
        /// <param name="connection">Connection to set on the new <see cref="AipcAttribute"/>.</param>
        /// <returns>Returns the new <see cref="AipcAttriute"/>.</returns>
        public AipcAttribute CreateNew(AipcConnection connection)
        {
            AipcAttribute attributes = new AipcAttribute(connection)
            {
                noDelay = this.noDelay,
                writePause = this.writePause,
                readPause = this.readPause,
                readPriority = this.readPriority,
                writePriority = this.writePriority,
                retry = this.retry,
                clientData = this.clientData,
                debug = this.debug,
                burstMode = this.burstMode,
                listener = this.listener,
                readBufsize = this.readBufsize,
                writeBufSize = this.writeBufSize
            };

            return attributes;
        }
Ejemplo n.º 9
0
        internal AipcConnection(
            AipcService aipcService,
            ConnectionAttribute connectionAttribute,
            AipcAttribute aipcAttribute,
            Socket socket)
        {
            this.aipcService = aipcService;
            this.connectionAttributes = connectionAttribute;
            this.partialSent = false;

            if (aipcAttribute != null)
            {
                this.aipcAttributes = aipcAttribute.CreateNew(this);
            }
            else
            {
                this.aipcAttributes = AipcAttribute.Create(this);
            }

            this.Socket = socket;
        }
Ejemplo n.º 10
0
        private AipcConnection Create(ConnectionAttribute connectionAttribute, AipcAttribute aipcAttributes, Socket socket)
        {
            AipcConnection connection;

            switch (connectionAttribute.Protocol.asString)
            {
                case "A":
                    connection = new AConnection(this, connectionAttribute, aipcAttributes, socket);
                    break;
                case "string":
                    connection = new StringConnection(this, connectionAttribute, aipcAttributes, socket);
                    break;
                case "raw":
                    connection = new RawConnection(this, connectionAttribute, aipcAttributes, socket);
                    break;
                case "simple":
                    connection = new SimpleConnection(this, connectionAttribute, aipcAttributes, socket);
                    break;
                default:
                    connectionAttribute.HandleNumber = -1;
                    connection = null;
                    break;
            }

            if (connectionAttribute.HandleNumber != -1)
            {
                connectionAttribute.HandleNumber = NextHandleNumber();
                AddToRoster(connection);
            }

            return connection;
        }
Ejemplo n.º 11
0
        public void InitFromListener(ConnectionAttribute connectionAttribute, AipcAttribute aipcAttributes, Socket socket)
        {
            ConnectionAttribute attribute = connectionAttribute.Clone();
            attribute.IsListener = false;
            AipcConnection connection = Create(attribute, aipcAttributes, socket);

            connection.AipcAttributes.Listener = connectionAttribute.HandleNumber;
            connection.MakeCallback("connected", AInteger.Create(connection.AipcAttributes.Listener));
        }