[TOC] > [参考](https://github.com/xfxdev/xtcp) ## 使用 Create server: ``` // 1. create protocol and handler. // ... // 2. create opts. opts := xtcp.NewOpts(handler, protocol) // 3. create server. server := xtcp.NewServer(opts) // 4. start. go server.ListenAndServe("addr") ``` Create client: ``` // 1. create protocol and handler. // ... // 2. create opts. opts := xtcp.NewOpts(handler, protocol) // 3. create client. client := NewConn(opts) // 4. start go client.DialAndServe("addr") ```