duanliao5995
2017-03-05 22:23
浏览 540

Golang WebSocket的SetWriteDeadline函数

Go's websockets have a SetWriteDeadline() function to set the connection's network write deadline. Do I need to set it before every data sending or it can be done just once when the connection is created?

图片转代码服务由CSDN问答提供 功能建议

Go的网络套接字具有 SetWriteDeadline()函数,用于设置连接的网络写入期限。 我是否需要在每次发送数据之前进行设置,还是在创建连接后仅进行一次设置?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • dongmin4052 2017-03-06 03:35

    Set it once.

    PS I checked it myself, it's a simple code.

    点赞 打赏 评论
  • doujiao3016 2019-01-24 18:02

    For it to be useful at all, set it every time. Note that it takes a time.Time, not a time.Duration:

    SetWriteDeadline(t time.Time) error
    
    点赞 打赏 评论

相关推荐 更多相似问题