HALP: breaking a function with keyboard interrupt [no signals]

polaris · · 385 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>REFERENCE-CODE: <a href="https://play.golang.org/p/6WSfbNvvhr" rel="nofollow">https://play.golang.org/p/6WSfbNvvhr</a></p> <p>Hello, I&#39;m picking up golang by building a networking console-app to stream read and write captured packet data. using the google pcap library <a href="https://godoc.org/github.com/google/gopacket/pcap" rel="nofollow">https://godoc.org/github.com/google/gopacket/pcap</a></p> <p>so far the bottom function runs a continuous stream until I send a SIGKILL...but this is not desired because I want the option to return to a main menu and run other options.</p> <p>SO WHAT: how can I break out of this function from keyboard input without using signal interrupts (PS. I tried bufio scanner. but that just holds up my stream until user input. which isnt desired)</p> <p>HALP</p>

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

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