精华内容
下载资源
问答
  • * make a bunch of legacy presets non-searchable (existing features will still be recognized by iD, but new features will get both the legacy and the PTv2 tags). * add new presets under <code>data/...
  • 代码地址:http://git.oschina.net/walleipt/es-cluster/blob/master/src/main/java/com/waleipt/api/es/tcptransport/Custom_protocol_test.java?dir=0&filepath=src/main/java/com/waleipt/ap

    交互过程
    Node-Client发送用户信息给到Node-Server;Node-Server接收到用户信息进行业务处理;然后将执行结果发回给Node-Client;Node-client接收到结果后在进行业务处理;

    注意:如上提到的Node-Server和Node-client是在ES中是不会如此划分的,这里主要是为了熟悉和记忆api的使用为之后提炼出需要的api做准备。
    
    • 代码解析

      添加用户的请求信息:

     public class UserRequest extends TransportRequest{
        public int id ;
    
        public String name ;
    
        public int age ;
        public UserRequest() {}
        public UserRequest( int id, String name, int age ) {
    
            this.id = id ;
            this.name = name ;
            this.age = age ;
        }
    
        @Override
        public void readFrom(StreamInput in) throws IOException {
    
            // 解码过程
    
            this.id = in.readInt() ;
    
            Text text = in.readText() ;
    
            this.name =  text.toString() ;
    
            this.age = in.readInt() ;
    
        }
    
        @Override
        public void writeTo(StreamOutput out) throws IOException {
            // 编码过程
    
            out.writeInt( this.id );
    
            out.writeText( new Text(this.name) );
    
            out.writeInt( age );
    
        }
    
    }

    添加用户的响应信息:

     public class UserResponse extends TransportResponse
    
        {
    
            public int status ;
            public String reason ;
    
            public UserResponse(){}
    
            public UserResponse( int status, String reason )
            {
                this.status = status ;
                this.reason = reason ;
            }
            @Override
            public void readFrom(StreamInput in) throws IOException {
    
        //        super.readFrom(in);
    
        //       解码过程
    
                this.status = in.readInt() ;
                this.reason = in.readString();
            }
    
            @Override
            public void writeTo(StreamOutput out) throws IOException 
            {
    
        //        super.writeTo(out);
        //      编码过程
    
                out.writeInt( this.status );
                out.writeString( this.reason );
            }
    
        }

    注意:如上请求和响应涉及到传输过程中的编码解码,见注释,本篇之关注两node的通信过程及其API;
    对于tcp传输过程中的协议解析(字节码解析)之后在开一篇日志。

    • 启动服务Node:
     // 初始化服务端Node
    
        Server_Node server_node = new Server_Node( 9300 ) ;
        // 注册需要如何处理action_1的请求
        server_node.regHandleRequest( "action_1", UserRequest::new, 
                      (request,channel)->{
                          // 输出请求信息
                          System.err.println( String.format( "处理请求参数:id/name/age:%d/%s/%d", request.id, request.name, request.age ) );
    
                          // 响应客户端信息
                          channel.sendResponse( new UserResponse( 3, "199999") );
    
        });
        // 启动服务端
        server_node.start();

    regHandleRequest方法定义如何处理action_1这种请求,其中包含3个参数:
    action=“action_1”表示请求协议名称,也可以认为是spring mvn中的action
    requset=”UserRequest::new”表示接受的请求信息
    handlerReuqest=”(request,channel)->{}”表示请求如何处理(这里使用jdk8的函数式语法) ;request是请求信息,channel是连接通道,处理的过程为:打印请求信息,通过channel响应客户端信息

    • 启动客户端Node:
      // 初始化客户端
        Client_Node client_node = new Client_Node( 9301 ) ;
        client_node.start();
    
    
        // 连接服务端
        client_node.connectToNode( "127.0.0.1", 9300 );
    
    
        // 发送请求到服务端
        long requestId = 42 ;
        String action = "action_1" ;
        UserRequest request = new UserRequest( 1, "王五", 23) ;
    
        client_node.sendRequest(requestId, action, request,
              new TransportResponseHandler<UserResponse>() {
    
    
              @Override
              public UserResponse newInstance() {
                      return new UserResponse();
              }
    
              @Override
              public void handleResponse(UserResponse response) {
                       System.err.println( String.format( "处理服务端返回结果:status/reason/:%d/%s", response.status, response.reason ) );                                        
              }
    
    
              @Override
    
              public void handleException(TransportException exp) {
                      // TODO Auto-generated method stub          
              }
    
    
              @Override
              public String executor() {
                      return ThreadPool.Names.SAME;
              }
    
        });

    sendRequest方法解析如下:
    requestId:请求的序列,多个请求为了区分出不同请求需要此序列号 action:请求的协议名
    requset:请求的内容
    responseHandler:如何处理服务端返回信息,handleResponse此方法为关键方法,获取到了服务端返回的内容信息。

    展开全文
  • http2 transport errors

    2021-01-06 05:11:31
    : http2: Transport: peer server initiated graceful shutdown after some of Request.Body was written; define Request.GetBody to avoid this error</code></p> <p>If it makes any difference, this is with ...
  • Bird 的 经典传递参考书 Transport Phenomena, 2nd Edition
  • I more or less left SyncTransport as it is (just removed one constructor) and everything happens in Transport. When Transport.closes either stream, everything up to Socket (including) should be ...
  • HTTP/2 transport

    2021-01-06 06:08:05
    <div><p>Now that <a href="http://blog.chromium.org/2015/02/hello-http2-goodbye-spdy-http-is_9.html">SPDY is being set aside for HTTP/2 in chromium, we should consider what an http/2 implementation ...
  • Transport sync in Netjack2

    2020-11-28 02:31:14
    <div><p>A commit from may 2011 (6d7823290fc02b74d8aaa649f749071c9d8cdda2) deactivate the transport sync, so it don't work :) Is it still necessary ? <p>Thanks a lot</p><p>该提问来源于开源项目ÿ...
  • from authlib.client import OAuth2Session session = OAuth2Session(client_id='example', scope=scope'test') uri, state = session.authorization_url(url='...
  • <div><p>While in http/1.1 the <code>http.Transport.DisableKeepAlives</code> directive disallows re-usage of the connection, in http2 it's currently implemented as "close the connection as soon...
  • <div><p>The <em>Transport</em> class provided by the qpid transport creates a pipe in <strong>init(). The pipe file descriptors are never closed. As a result, each connect or re-connect causes these ...
  • bindgen, we can write an implementation of <code>Transport</code> that gets passed a <code>JsValue</code> which is expected to conform to https://github.com/libp2p/interface-transport This way, we can...
  • Implement a libp2p transport

    2020-12-09 03:26:52
    In other words implement a transport that is functionally identical to the one we are currently using (<code>libp2p::build_development_transport). <p>Initial patch updates libp2p from 0.12 -> 0.13...
  • MPEG-2 Transport Stream Multiplexers

    转自:http://www.manzanitasystems.com/products/transport-stream-multiplexer.html

    Transport Stream Multiplexer Software Solutions

    Manzanita's transport stream multiplexer product line consists of two standalone multiplexer software applications and an SDK that can output compliant MPEG-2 transport stream files. Since 1998, Manzanita TS multiplexers have been selected by leading network operators, post production & services facilities, MPEG equipment manufacturers, and content providers because of their reliability, rich feature set and compliance with industry standards.

    Manzanita multiplexers are the defacto software solution, producing VOD content that is proven to play smoothly on cable, IPTV, satellite, hotel, and in-flight entertainment systems worldwide, and offering predefined configurations for CableLabs standards and fine controls to adapt templates to meet specific transport stream multiplexing requirements.

    Highlights
    • Multiplexes a wide variety of audio/video elementary streams
    • Proven compliance with MPEG, ATSC & DVB specs
    • Super fast multiplexing, up to 50 times faster than realtime
    • Supports DVB subtitling, 608 & 708 closed captioning, & KLV metadata
    • Fine control over transport stream creation/parameters
    • Added tools for advanced and custom applications
    • Available as SDK and standalone product
    Major Features
    • Proven support for major formats & worldwide standards including MPEG-1, MPEG-2, MPEG-4 / AVC / h.264 & HEVC/h.265 video streams, as well as 4:2:2 and Multi-view profiles; audio streams include MPEG, AAC, AC-3, SMPTE 302M, DTS & Enhanced AC-3 audio; standards include MPEG, DVB, and ATSC.
    • Fast multiplexing workflow with performance that's up to 50 times faster than realtime and automated processing options.
    • Fine control over Transport Stream creation. Modify over 200 multiplexing parameters to precisely control the transport, adaptation, PES, timing, buffer usage, synchronization and much more.
    • Advanced tools for diverse applications such as inserting advertising (SCTE-35) messages, stitching transport stream files while maintaining sync, multiplexing 608 & 708 closed captioning and DVB Subtitling, extracting packets, generating and inserting custom tables.
    • Multiple product options and configurations. Available as a stand-alone application or SDK for offline and real-time transport stream multiplexing.
      • Enhanced TS multiplexer - MP2TSME
      • Single-program TS multiplexer - MP2TSMS
      • TS Multiplexer SDK

    展开全文
  • <code>libp2p</code> aims to be a generally-useful networking library and having a tor transport would be a boon! The process could also simplify bine usage 😄 </p><p>该提问来源于开源项目ÿ...
  • 2016/08/11 16:35:16 transport: http2Client.notifyError got notified that the client transport was broken unexpected EOF. 2016/08/11 16:35:16 transport: ...
  • Tor transport

    2020-11-28 11:13:44
    This Transport allows users of libp2p to run all TCP traffic over the Tor network. <p>For the listener side of the application, using this transport, one can pass an onion address to the application....
  • 为了配置servlet transport需要做两件事情: (1)在web.xml中注册并映射org.apache...(2)在axis2.xml中声明协议接收器org.apache.axis2.transport.http.AxisServletListener。   &lt;servlet&gt; ...

    为了配置servlet transport需要做两件事情:

    (1)在web.xml中注册并映射org.apache.axis2.transport.http.AxisServlet.

    (2)在axis2.xml中声明协议接收器org.apache.axis2.transport.http.AxisServletListener。

     

        <servlet>
            <servlet-name>AxisServlet</servlet-name>
            <display-name>Apache-Axis Servlet</display-name>
            <servlet-class>org.apache.axis2.transport.http.AxisServlet</servlet-class>
            <load-on-startup>1</load-on-startup>
        </servlet>
        <servlet-mapping>
            <servlet-name>AxisServlet</servlet-name>
            <url-pattern>/services/*</url-pattern>
        </servlet-mapping>

     

     

     

     

     

     

    <transportReceiver name="http" class="org.apache.axis2.transport.http.AxisServletListener">
        <parameter name="port">8080</parameter>
    </transportReceiver>
    
    <transportReceiver name="https" class="org.apache.axis2.transport.http.AxisServletListener">
        <parameter name="port">8443</parameter>
    </transportReceiver>

     

    最后欢迎大家访问我的个人网站:1024s

     

     

     

    展开全文
  • <div><p>This allows the caller to change some configurations of the http2 transport when constructing it from an http1 transport.</p> <p>Fixes golang/go#40201.</p><p>该提问来源于开源项目:golang...
  • 2.2 Transport ActiveMQ目前支持的transport有:VM Transport、TCP Transport、SSL Transport、Peer Transport、UDP Transport、Multicast Transport、HTTP and HTTPS Transport、Failover Transp...

     

    关键字: activemq

    2.2 Transport
        ActiveMQ目前支持的transport有:VM Transport、TCP Transport、SSL Transport、Peer Transport、UDP Transport、Multicast Transport、HTTP and HTTPS Transport、Failover Transport、Fanout Transport、Discovery Transport、ZeroConf Transport等。以下简单介绍其中的几种,更多请参考Apache官方文档。

     

    2.2.1 VM Transport
        VM transport允许在VM内部通信,从而避免了网络传输的开销。这时候采用的连接不是socket连接,而是直接地方法调用。 第一个创建VM 连接的客户会启动一个embed VM broker,接下来所有使用相同的broker name的VM连接都会使用这个broker。当这个broker上所有的连接都关闭的时候,这个broker也会自动关闭。
        以下是配置语法:

       vm://brokerName?transportOptions

       例如:vm://broker1?marshal=false&broker.persistent=false

       Transport Options的可选值如下:

    Option Name Default Value Description
    Marshal false If true, forces each command sent over the transport to be marshlled and unmarshlled using a WireFormat
    wireFormat default The name of the WireFormat to use
    wireFormat.*   All the properties with this prefix are used to configure the wireFormat
    create true If the broker should be created on demand if it does not allready exist. Only supported in ActiveMQ 4.1
    broker.*   All the properties with this prefix are used to configure the broker. See Configuring Wire Formats for more information

     

       以下是高级配置语法:

       vm:(broker:(tcp://localhost)?brokerOptions)?transportOptions

       vm:broker:(tcp://localhost)?brokerOptions

        例如:vm:(broker:(tcp://localhost:6000)?persistent=false)?marshal=false

        Transport Options的可选值如下:

    Option Name Default Value Description
    marshal false If true, forces each command sent over the transport to be marshlled and unmarshlled using a WireFormat
    wireFormat default The name of the WireFormat to use
    wireFormat.*   All the properties with this prefix are used to configure the wireFormat

     

       使用配置文件的配置语法:   
        vm://localhost?brokerConfig=xbean:activemq.xml
        例如:vm:// localhost?brokerConfig=xbean:com/test/activemq.xml

     

       使用Spring的配置:

    Xml代码 复制代码
    1. <bean id="broker" class="org.apache.activemq.xbean.BrokerFactoryBean">  
    2.   <property name="config" value="classpath:org/apache/activemq/xbean/activemq.xml" />  
    3.   <property name="start" value="true" />  
    4. </bean>  
    5.   
    6. <bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory" depends-on="broker">  
    7.   <property name="brokerURL" value="vm://localhost"/>  
    8. </bean>  
       如果persistent是true,那么ActiveMQ会在当前目录下创建一个缺省值是activemq-data的目录用于持久化保存数据。需要注意的是,如果程序中启动了多个不同名字的VM broker,那么可能会有如下警告:Failed to start jmx connector: Cannot bind to URL [rmi://localhost:1099/jmxrmi]: javax.naming.NameAlreadyBoundException…可以通过在transportOptions中追加broker.useJmx=false来禁用JMX来避免这个警告。

     

    2.2.2 TCP Transport
        TCP transport 允许客户端通过TCP socket连接到远程的broker。以下是配置语法:
        tcp://hostname:port?transportOptions
        Transport Options的可选值如下:

    Option Name Default Value Description
    minmumWireFormatVersion 0 The minimum version wireformat that is allowed
    trace false Causes all commands that are sent over the transport to be logged
    useLocalHost true When true, it causes the local machines name to resolve to "localhost".
    socketBufferSize 64 * 1024 Sets the socket buffer size in bytes
    soTimeout 0 sets the socket timeout in milliseconds
    connectionTimeout 30000 A non-zero value specifies the connection timeout in milliseconds. A zero value means wait forever for the connection to be established. Negative values are ignored.
    wireFormat default The name of the WireFormat to use
    wireFormat.*   All the properties with this prefix are used to configure the wireFormat. See Configuring Wire Formats for more information

       例如:tcp://localhost:61616?trace=false

     

    2.2.3 Failover Transport
        Failover Transport是一种重新连接的机制,它工作于其它transport的上层,用于建立可靠的传输。它的配置语法允许制定任意多个复合的URI。Failover transport会自动选择其中的一个URI来尝试建立连接。如果没有成功,那么会选择一个其它的URI来建立一个新的连接。以下是配置语法:
        failover:(uri1,...,uriN)?transportOptions
        failover:uri1,...,uriN
        Transport Options的可选值如下:

    Option Name Default Value Description
    initialReconnectDelay 10 How long to wait before the first reconnect attempt (in ms)
    maxReconnectDelay 30000 The maximum amount of time we ever wait between reconnect attempts (in ms)
    useExponentialBackOff true Should an exponential backoff be used between reconnect attempts
    backOffMultiplier 2 The exponent used in the exponential backoff attempts
    maxReconnectAttempts 0 If not 0, then this is the maximum number of reconnect attempts before an error is sent back to the client
    randomize true use a random algorithm to choose the URI to use for reconnect from the list provided
    backup false initialize and hold a second transport connection - to enable fast failover

       例如:failover:(tcp://localhost:61616,tcp://remotehost:61616)?initialReconnectDelay=100

     

    2.2.4 Discovery transport
        Discovery transport是可靠的tranport。它使用Discovery transport来定位用来连接的URI列表。以下是配置语法:
        discovery:(discoveryAgentURI)?transportOptions
        discovery:discoveryAgentURI
        Transport Options的可选值如下:

    Option Name Default Value Description
    initialReconnectDelay 10 How long to wait before the first reconnect attempt
    maxReconnectDelay 30000 The maximum amount of time we ever wait between reconnect attempts
    useExponentialBackOff true Should an exponential backoff be used btween reconnect attempts
    backOffMultiplier 2 The exponent used in the exponential backoff attempts
    maxReconnectAttempts 0 If not 0, then this is the maximum number of reconnect attempts before an error is sent back to the client

       例如:discovery:(multicast://default)?initialReconnectDelay=100   
        为了使用Discovery来发现broker,需要为broker启用discovery agent。 以下是XML配置文件中的一个例子:

    Xml代码 复制代码
    1. <broker name="foo">  
    2.    <transportConnectors>  
    3.       <transportConnector uri="tcp://localhost:0" discoveryUri="multicast://default"/>  
    4.     </transportConnectors>  
    5.     ...   
    6. </broker>  
       在使用Failover Transport或Discovery transport等能够自动重连的transport的时候,需要注意的是:设想有两个broker,它们都启用AMQ Message Store作为持久化存储,有一个producer和一个consumer连接到某个queue。当因其中一个broker失效时而切换到另一个broker的时候,如果失效的broker的queue中还有未被consumer消费的消息,那么这个queue里的消息仍然滞留在失效broker的中,直到失效的broker被修复并重新切换回这个被修复的broker后,之前被保留的消息才会被consumer消费掉。如果被处理的消息有时序限制,那么应用程序就需要处理这个问题。另外也可以通过ActiveMQ集群来解决这个问题。

       在transport重连的时候,可以在connection上注册TransportListener来获得回调,例如:

    Java代码 复制代码
    1. (ActiveMQConnection)connection).addTransportListener(new TransportListener() {   
    2.     public void onCommand(Object cmd) {   
    3.     }   
    4.   
    5.     public void onException(IOException exp) {   
    6.     }   
    7.   
    8.     public void transportInterupted() {   
    9.         // The transport has suffered an interruption from which it hopes to recover.  
    10.     }   
    11.   
    12.     public void transportResumed() {   
    13.         // The transport has resumed after an interruption.   
    14.     }   
    15. });  

    转载于:https://www.cnblogs.com/wely/p/6198671.html

    展开全文
  • Transport Resumption

    2020-12-27 16:48:27
    <p>When the underlying transport is lost, the queues will hold and buffer more messages (outgoing) up to some limit, and when a new transport was established in due time, and providing the last ...
  • Transport trait

    2020-11-28 21:11:35
    <div><p>There are still a couple of todos, but would like to clear some questions in the meantime: <ul><li>[ ] Is the new Transport/Dialer trait ok</li><li>[ ] Is using ...libp2p/rust-libp2p</p></div>
  • websocket transport

    2020-12-08 19:54:06
    <div><p>Could not connect to example server using websocket transport. Browser returns errors "NetworkError: 400 Bad Request - http://localhost:5000/engine.io/?EIO=2&transport=...
  • Investigation of electron transport properties in Li2CO3-doped Bepp2 thin films
  • Tracing through the code these message come from the networkLoop thread which is trying to call establishConnection() in HTTP2Transport. However, there are no error message printed in ...
  • Transport refactor

    2020-12-02 19:53:42
    <div><p>This PR contains a stack of changes that are based around refactoring transport to allow for transport hot-swapping. The goal is to allow the user to change transports on the fly. In order to ...
  • oauth2.Transport not found?

    2021-01-06 11:41:16
    oauth2.Transport{ Source: google.AppEngineTokenSource(ctx, compute.ComputeScope), Base: &urlfetch.Transport{Context: ctx}, }, </code></pre> <p>This is frustrating because either I am not ...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 21,199
精华内容 8,479
关键字:

transport2