Source File
unixsock.go
Belonging Package
net
package net
import (
)
func ( *UnixConn) ( []byte, Addr) (int, error) {
if !.ok() {
return 0, syscall.EINVAL
}
, := .(*UnixAddr)
if ! {
return 0, &OpError{Op: "write", Net: .fd.net, Source: .fd.laddr, Addr: , Err: syscall.EINVAL}
}
, := .writeTo(, )
if != nil {
= &OpError{Op: "write", Net: .fd.net, Source: .fd.laddr, Addr: .opAddr(), Err: }
}
return ,
}
func ( string, , *UnixAddr) (*UnixConn, error) {
switch {
case "unix", "unixgram", "unixpacket":
default:
return nil, &OpError{Op: "dial", Net: , Source: .opAddr(), Addr: .opAddr(), Err: UnknownNetworkError()}
}
:= &sysDialer{network: , address: .String()}
, := .dialUnix(context.Background(), , )
if != nil {
return nil, &OpError{Op: "dial", Net: , Source: .opAddr(), Addr: .opAddr(), Err: }
}
return , nil
}
type UnixListener struct {
fd *netFD
path string
unlink bool
unlinkOnce sync.Once
}
func ( *UnixListener) () bool { return != nil && .fd != nil }
func ( *UnixListener) () (syscall.RawConn, error) {
if !.ok() {
return nil, syscall.EINVAL
}
return newRawListener(.fd)
}
func ( *UnixListener) () Addr { return .fd.laddr }
func ( string, *UnixAddr) (*UnixListener, error) {
switch {
case "unix", "unixpacket":
default:
return nil, &OpError{Op: "listen", Net: , Source: nil, Addr: .opAddr(), Err: UnknownNetworkError()}
}
if == nil {
return nil, &OpError{Op: "listen", Net: , Source: nil, Addr: .opAddr(), Err: errMissingAddress}
}
:= &sysListener{network: , address: .String()}
, := .listenUnix(context.Background(), )
if != nil {
return nil, &OpError{Op: "listen", Net: , Source: nil, Addr: .opAddr(), Err: }
}
return , nil
}
func ( string, *UnixAddr) (*UnixConn, error) {
switch {
case "unixgram":
default:
return nil, &OpError{Op: "listen", Net: , Source: nil, Addr: .opAddr(), Err: UnknownNetworkError()}
}
if == nil {
return nil, &OpError{Op: "listen", Net: , Source: nil, Addr: nil, Err: errMissingAddress}
}
:= &sysListener{network: , address: .String()}
, := .listenUnixgram(context.Background(), )
if != nil {
return nil, &OpError{Op: "listen", Net: , Source: nil, Addr: .opAddr(), Err: }
}
return , nil
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |