コード例 #1
0
        private async Task <IServiceServerLink> CreateServiceServerLinkAsync(
            string service,
            bool persistent,
            string requestMd5Sum,
            string responseMd5Sum,
            IDictionary <string, string> headerValues,
            Action <ServiceServerLink> initialize
            )
        {
            (string host, int port) = await LookupServiceAsync(service).ConfigureAwait(false);

            var client = new TcpClient();
            await client.ConnectAsync(host, port).ConfigureAwait(false);

            client.NoDelay = true;

            var connection = new Connection(client);
            var link       = new ServiceServerLink(connection, service, persistent, requestMd5Sum, responseMd5Sum, headerValues);

            initialize(link);

            lock (gate)
            {
                serviceServerLinksAsync.Add(link);
            }

            return(link);
        }
コード例 #2
0
        internal ServiceServerLink <M, T> CreateServiceServerLink <M, T>(string service, bool persistent, string request_md5sum,
                                                                         string response_md5sum, IDictionary <string, string> header_values)
            where M : RosMessage, new()
            where T : RosMessage, new()
        {
            lock ( shuttingDownMutex )
            {
                if (shuttingDown)
                {
                    return(null);
                }
            }

            int    serv_port = -1;
            string serv_host = "";

            if (!LookupService(service, ref serv_host, ref serv_port))
            {
                return(null);
            }
            TcpTransport transport = new TcpTransport(pollManager.poll_set);

            if (transport.connect(serv_host, serv_port))
            {
                Connection connection = new Connection();
                connectionManager.AddConnection(connection);
                ServiceServerLink <M, T> client = new ServiceServerLink <M, T>(service, persistent, request_md5sum, response_md5sum, header_values);
                lock (serviceServerLinksMutex)
                    serviceServerLinks.Add(client);
                connection.initialize(transport, false, null);
                client.initialize(connection);
                return(client);
            }
            return(null);
        }
コード例 #3
0
 internal void RemoveServiceServerLink <S>(ServiceServerLink <S> issl)
     where S : RosService, new()
 {
     RemoveServiceServerLink((IServiceServerLink)issl);
 }
コード例 #4
0
 internal void RemoveServiceServerLink <M, T>(ServiceServerLink <M, T> issl)
     where M : RosMessage, new()
     where T : RosMessage, new()
 {
     RemoveServiceServerLink((IServiceServerLink)issl);
 }