public StringConnection( AipcService aipcService, ConnectionAttribute attribute, AipcAttribute aipcAttributes, Socket socket) : base(aipcService, attribute, aipcAttributes, socket) { }
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)); }
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); } }
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; }
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)); }
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); }
internal AipcConnection(AipcService aipcService, ConnectionAttribute connectionAttribute) : this(aipcService, connectionAttribute, null, null) { }
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); }
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; }
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); }
public StringConnection(AipcService aipcService, ConnectionAttribute attribute) : base(aipcService, attribute, null, null) { }