当前位置: 首页>>代码示例>>Golang>>正文


Golang Socket.GetOption方法代码示例

本文整理汇总了Golang中github.com/gdamore/mangos.Socket.GetOption方法的典型用法代码示例。如果您正苦于以下问题:Golang Socket.GetOption方法的具体用法?Golang Socket.GetOption怎么用?Golang Socket.GetOption使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/gdamore/mangos.Socket的用法示例。


在下文中一共展示了Socket.GetOption方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: NewListener

func (t wsTran) NewListener(addr string, sock mangos.Socket) (mangos.PipeListener, error) {
	proto := sock.GetProtocol()
	l, e := t.listener(addr, proto)
	if e == nil {
		if v, e := sock.GetOption(mangos.OptionMaxRecvSize); e == nil {
			l.maxrx = v.(int)
		}
		l.mux.Handle(l.url.Path, l)
	}
	return l, e
}
开发者ID:lucmichalski,项目名称:mangos,代码行数:11,代码来源:ws.go

示例2: NewDialer

func (wsTran) NewDialer(addr string, sock mangos.Socket) (mangos.PipeDialer, error) {
	iswss := strings.HasPrefix(addr, "wss://")
	opts := make(map[string]interface{})

	opts[mangos.OptionNoDelay] = true
	opts[mangos.OptionKeepAlive] = true
	proto := sock.GetProtocol()
	maxrx := 0
	if v, e := sock.GetOption(mangos.OptionMaxRecvSize); e == nil {
		maxrx = v.(int)
	}

	return &dialer{addr: addr, proto: proto, iswss: iswss, opts: opts, maxrx: maxrx}, nil
}
开发者ID:lucmichalski,项目名称:mangos,代码行数:14,代码来源:ws.go


注:本文中的github.com/gdamore/mangos.Socket.GetOption方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。