예제 #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)
 { }