2017-11-30 10:16:55 +00:00
|
|
|
package client
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net"
|
|
|
|
|
|
|
|
csc "git.loafle.net/commons_go/server/client"
|
|
|
|
"gopkg.in/natefinch/npipe.v2"
|
|
|
|
)
|
|
|
|
|
|
|
|
func newSocketBuilder(address string) csc.SocketBuilder {
|
|
|
|
sb := &SocketBuilders{}
|
|
|
|
sb.Network = "pipe"
|
|
|
|
sb.Address = address
|
|
|
|
|
|
|
|
return sb
|
|
|
|
}
|
|
|
|
|
2017-12-01 03:45:04 +00:00
|
|
|
func (sb *SocketBuilders) Dial(network, address string) (net.Conn, error) {
|
2017-12-01 08:29:54 +00:00
|
|
|
if 0 == sb.HandshakeTimeout {
|
|
|
|
return npipe.Dial(`\\.\pipe\` + address)
|
|
|
|
}
|
2017-12-01 03:45:04 +00:00
|
|
|
return npipe.DialTimeout(`\\.\pipe\`+address, sb.HandshakeTimeout)
|
2017-11-30 10:16:55 +00:00
|
|
|
}
|