Reverse TCP Connection?

xuanbao · · 924 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>So i want to have a Server and a client. The client shouldn&#39;t need to have open ports, only the server. They should be able to talk back-and-forth to each other...</p> <p>Anyone know of a example using a client-server system like this for GoLang?</p> <hr/>**评论:**<br/><br/>aagee: <pre><p>Not sure why you are characterizing this as a reverse TCP connection. The normal use case is that a client opens a connection to the server. The connection is two way - they can both talk to each other on the connection.</p> <p>Do you mean that the server should be able to open a connection to the client?</p> <p>Here is a code example.</p> <p><a href="https://systembash.com/a-simple-go-tcp-server-and-tcp-client/" rel="nofollow">https://systembash.com/a-simple-go-tcp-server-and-tcp-client/</a></p></pre>calebdoxsey: <pre><p><a href="https://www.youtube.com/watch?v=SR9ggHOJsrg" rel="nofollow">https://www.youtube.com/watch?v=SR9ggHOJsrg</a></p></pre>jpluscplusm: <pre><p>This is called &#34;TCP&#34;.</p> <p>Welcome to The Internet.</p></pre>TheMerovius: <pre><p>Please don&#39;t be snarky. OP may not have as good an understanding as you of things, but that doesn&#39;t mean it is okay to talk down to them.</p></pre>bear1728: <pre><p>Don&#39;t <a href="https://en.wikipedia.org/wiki/WebSockets" rel="nofollow">websockets</a> do this? I believe they are over TCP and use standard http ports...</p></pre>terrkerr: <pre><p>Normal sockets work just fine; websockets only really exists so that you have a defined way to get a TCP socket going on a port that is <em>also</em> doing HTTP. </p> <p>If you aren&#39;t running an HTTP server - or don&#39;t really have any issue with clients having limited outbound traffic, which is often the case, and can therefore use an arbitrary port - just use native sockets.</p></pre>bear1728: <pre><p>That&#39;s a great point. I guess I misinterpreted OP&#39;s post to mean some kind of webserver (with clients as browsers). I blame too many postings on about webapps. Using native socket&#39;s in go is also easy! There are some examples in <a href="http://golang.org/pkg/net/" rel="nofollow">the net package</a>.</p></pre>SaturnsVoid: <pre><p>Would this need to be a actual web application or can i have it as a .exe?</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

924 次点击  
加入收藏 微博
0 回复
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传