Пример #1
0
 public StringConnection(
     AipcService aipcService,
     ConnectionAttribute attribute,
     AipcAttribute aipcAttributes,
     Socket socket)
     : base(aipcService, attribute, aipcAttributes, socket)
 { }
Пример #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));
        }
Пример #3
0
        internal int GetPortByServiceName(AType name)
        {
            lock (mutex)
            {
                foreach (KeyValuePair <int, AipcConnection> item in roster)
                {
                    ConnectionAttribute attrbiutes = item.Value.ConnectionAttributes;
                    if (attrbiutes.IsListener && attrbiutes.Name.asString == name.asString)
                    {
                        return(item.Value.ConnectionAttributes.Port);
                    }
                }

                return(0);
            }
        }
Пример #4
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;
        }
Пример #5
0
        public AType Connect(
            AType func, AType name, AType host, int port, AType protocol)
        {
            AipcConnection      connection;
            ConnectionAttribute attribute = new ConnectionAttribute
            {
                Function = func,
                Name     = name,
                Protocol = protocol,
                Port     = port,
                Host     = host
            };

            connection = Create(attribute, null, null);

            if (connection == null)
            {
                return(AInteger.Create(-1));
            }

            return(AInteger.Create(connection.ConnectionAttributes.HandleNumber));
        }
Пример #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);
        }
Пример #7
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;
        }
Пример #8
0
 internal AipcConnection(AipcService aipcService, ConnectionAttribute connectionAttribute)
     : this(aipcService, connectionAttribute, null, null)
 { }
Пример #9
0
        public AType Connect(
            AType func, AType name, AType host, int port, AType protocol)
        {
            AipcConnection connection;
            ConnectionAttribute attribute = new ConnectionAttribute
            {
                Function = func,
                Name = name,
                Protocol = protocol,
                Port = port,
                Host = host
            };

            connection = Create(attribute, null, null);

            if (connection == null)
            {
                return AInteger.Create(-1);
            }

            return AInteger.Create(connection.ConnectionAttributes.HandleNumber);
        }
Пример #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;
        }
Пример #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));
        }
Пример #12
0
        public AType Listen(AType func, AType name, AType host, int port, AType protocol)
        {
            AipcConnection connection;
            ConnectionAttribute attribute = new ConnectionAttribute()
            {
                Function = func,
                Name = name,
                Protocol = protocol,
                Port = port,
                ZeroPort = (port == 0),
                Host = host,
                IsListener = true
            };

            connection = Create(attribute, null, null);

            if (connection == null)
            {
                return AInteger.Create(-1);
            }

            return AInteger.Create(connection.ConnectionAttributes.HandleNumber);
        }
Пример #13
0
 internal AipcConnection(AipcService aipcService, ConnectionAttribute connectionAttribute)
     : this(aipcService, connectionAttribute, null, null)
 {
 }
Пример #14
0
 public StringConnection(AipcService aipcService, ConnectionAttribute attribute)
     : base(aipcService, attribute, null, null)
 { }