代码拉取完成,页面将自动刷新
/**********************************************************\
| |
| hprose |
| |
| Official WebSite: http://www.hprose.com/ |
| http://www.hprose.org/ |
| |
\**********************************************************/
/**********************************************************\
* *
* rpc/socket_client.go *
* *
* hprose socket client for Go. *
* *
* LastModified: Jan 7, 2017 *
* Author: Ma Bingyao <andot@hprose.com> *
* *
\**********************************************************/
package rpc
import (
"crypto/tls"
"net"
"time"
)
type socketTransport interface {
IdleTimeout() time.Duration
SetIdleTimeout(timeout time.Duration)
MaxPoolSize() int
SetMaxPoolSize(size int)
setCreateConn(createConn func() (net.Conn, error))
sendAndReceive(data []byte, context *ClientContext) ([]byte, error)
close()
}
// SocketClient is base struct for TCPClient and UnixClient
type SocketClient struct {
BaseClient
socketTransport
ReadBuffer int
WriteBuffer int
TLSConfig *tls.Config
}
func (client *SocketClient) initSocketClient() {
client.InitBaseClient()
client.socketTransport = newHalfDuplexSocketTransport()
client.ReadBuffer = 0
client.WriteBuffer = 0
client.TLSConfig = nil
client.SendAndReceive = client.sendAndReceive
}
// TLSClientConfig returns the tls.Config in hprose client
func (client *SocketClient) TLSClientConfig() *tls.Config {
return client.TLSConfig
}
// SetTLSClientConfig sets the tls.Config
func (client *SocketClient) SetTLSClientConfig(config *tls.Config) {
client.TLSConfig = config
}
// Close the client
func (client *SocketClient) Close() {
client.socketTransport.close()
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。