INodeSocket interface
表示 Node.js中 net
模块中的套接字。
此接口支持框架,不应直接为代码调用。
属性
buffer |
|
bytes |
|
bytes |
|
connecting | |
destroyed | |
local |
|
local |
|
readable | |
readable |
|
readable |
|
readable |
|
writable | |
writable |
|
writable |
方法
属性详细信息
bufferSize
bufferSize: number
属性值
number
bytesRead
bytesRead: number
属性值
number
bytesWritten
bytesWritten: number
属性值
number
connecting
connecting: boolean
属性值
boolean
destroyed
destroyed: boolean
属性值
boolean
localAddress
localAddress: string
属性值
string
localPort
localPort: number
属性值
number
readable
readable: boolean
属性值
boolean
readableFlowing
readableFlowing: boolean | null
属性值
boolean | null
readableHighWaterMark
readableHighWaterMark: number
属性值
number
readableLength
readableLength: number
属性值
number
writable
writable: boolean
属性值
boolean
writableHighWaterMark
writableHighWaterMark: number
属性值
number
writableLength
writableLength: number
属性值
number
方法详细信息
addListener("close", () => void)
function addListener(event: "close", listener: () => void): this
参数
- event
-
"close"
- listener
-
() => void
返回
this
addListener("data", (chunk: any) => void)
function addListener(event: "data", listener: (chunk: any) => void): this
参数
- event
-
"data"
- listener
-
(chunk: any) => void
返回
this
addListener("end", () => void)
function addListener(event: "end", listener: () => void): this
参数
- event
-
"end"
- listener
-
() => void
返回
this
addListener("error", (err: Error) => void)
function addListener(event: "error", listener: (err: Error) => void): this
参数
- event
-
"error"
- listener
-
(err: Error) => void
返回
this
addListener("readable", () => void)
function addListener(event: "readable", listener: () => void): this
参数
- event
-
"readable"
- listener
-
() => void
返回
this
addListener(string | symbol, (args: any[]) => void)
function addListener(event: string | symbol, listener: (args: any[]) => void): this
参数
- event
-
string | symbol
- listener
-
(args: any[]) => void
返回
this
address()
connect(any, () => void)
function connect(options: any, connectionListener?: () => void): any
参数
- options
-
any
- connectionListener
-
() => void
返回
any
connect(number, () => void)
function connect(port: number, connectionListener?: () => void): any
参数
- port
-
number
- connectionListener
-
() => void
返回
any
connect(number, string, () => void)
function connect(port: number, host: string, connectionListener?: () => void): any
参数
- port
-
number
- host
-
string
- connectionListener
-
() => void
返回
any
connect(string, () => void)
function connect(path: string, connectionListener?: () => void): any
参数
- path
-
string
- connectionListener
-
() => void
返回
any
cork()
function cork()
destroy(Error)
function destroy(error?: Error)
参数
- error
-
Error
emit("close")
function emit(event: "close"): boolean
参数
- event
-
"close"
返回
boolean
emit("data", any)
function emit(event: "data", chunk: any): boolean
参数
- event
-
"data"
- chunk
-
any
返回
boolean
emit("end")
function emit(event: "end"): boolean
参数
- event
-
"end"
返回
boolean
emit("error", Error)
function emit(event: "error", err: Error): boolean
参数
- event
-
"error"
- err
-
Error
返回
boolean
emit("readable")
function emit(event: "readable"): boolean
参数
- event
-
"readable"
返回
boolean
emit(string | symbol, any[])
function emit(event: string | symbol, args: any[]): boolean
参数
- event
-
string | symbol
- args
-
any[]
返回
boolean
end(() => void)
function end(cb?: () => void)
参数
- cb
-
() => void
end(any, () => void)
function end(chunk: any, cb?: () => void)
参数
- chunk
-
any
- cb
-
() => void
end(any, string, () => void)
function end(chunk: any, encoding?: string, cb?: () => void)
参数
- chunk
-
any
- encoding
-
string
- cb
-
() => void
eventNames()
function eventNames(): Array<string | symbol>
返回
Array<string | symbol>
getMaxListeners()
function getMaxListeners(): number
返回
number
isPaused()
function isPaused(): boolean
返回
boolean
listenerCount(string | symbol)
function listenerCount(type: string | symbol): number
参数
- type
-
string | symbol
返回
number
listeners(string | symbol)
function listeners(event: string | symbol): Function[]
参数
- event
-
string | symbol
返回
Function[]
off(string | symbol, (args: any[]) => void)
function off(event: string | symbol, listener: (args: any[]) => void): this
参数
- event
-
string | symbol
- listener
-
(args: any[]) => void
返回
this
on("close", (had_error: boolean) => void)
function on(event: "close", listener: (had_error: boolean) => void): this
参数
- event
-
"close"
- listener
-
(had_error: boolean) => void
返回
this
on("connect", () => void)
function on(event: "connect", listener: () => void): this
参数
- event
-
"connect"
- listener
-
() => void
返回
this
on("data", (data: INodeBuffer) => void)
function on(event: "data", listener: (data: INodeBuffer) => void): this
参数
- event
-
"data"
- listener
-
(data: INodeBuffer) => void
返回
this
on("end", () => void)
function on(event: "end", listener: () => void): this
参数
- event
-
"end"
- listener
-
() => void
返回
this
on("error", (err: Error) => void)
function on(event: "error", listener: (err: Error) => void): this
参数
- event
-
"error"
- listener
-
(err: Error) => void
返回
this
on(string, (args: any[]) => void)
function on(event: string, listener: (args: any[]) => void): this
参数
- event
-
string
- listener
-
(args: any[]) => void
返回
this
once("close", () => void)
function once(event: "close", listener: () => void): this
参数
- event
-
"close"
- listener
-
() => void
返回
this
once("data", (chunk: any) => void)
function once(event: "data", listener: (chunk: any) => void): this
参数
- event
-
"data"
- listener
-
(chunk: any) => void
返回
this
once("end", () => void)
function once(event: "end", listener: () => void): this
参数
- event
-
"end"
- listener
-
() => void
返回
this
once("error", (err: Error) => void)
function once(event: "error", listener: (err: Error) => void): this
参数
- event
-
"error"
- listener
-
(err: Error) => void
返回
this
once("readable", () => void)
function once(event: "readable", listener: () => void): this
参数
- event
-
"readable"
- listener
-
() => void
返回
this
once(string | symbol, (args: any[]) => void)
function once(event: string | symbol, listener: (args: any[]) => void): this
参数
- event
-
string | symbol
- listener
-
(args: any[]) => void
返回
this
pause()
function pause(): this
返回
this
pipe<T>(T, { end?: boolean })
function pipe<T>(destination: T, options?: { end?: boolean }): T
参数
- destination
-
T
- options
-
{ end?: boolean }
返回
T
prependListener("close", () => void)
function prependListener(event: "close", listener: () => void): this
参数
- event
-
"close"
- listener
-
() => void
返回
this
prependListener("data", (chunk: any) => void)
function prependListener(event: "data", listener: (chunk: any) => void): this
参数
- event
-
"data"
- listener
-
(chunk: any) => void
返回
this
prependListener("end", () => void)
function prependListener(event: "end", listener: () => void): this
参数
- event
-
"end"
- listener
-
() => void
返回
this
prependListener("error", (err: Error) => void)
function prependListener(event: "error", listener: (err: Error) => void): this
参数
- event
-
"error"
- listener
-
(err: Error) => void
返回
this
prependListener("readable", () => void)
function prependListener(event: "readable", listener: () => void): this
参数
- event
-
"readable"
- listener
-
() => void
返回
this
prependListener(string | symbol, (args: any[]) => void)
function prependListener(event: string | symbol, listener: (args: any[]) => void): this
参数
- event
-
string | symbol
- listener
-
(args: any[]) => void
返回
this
prependOnceListener("close", () => void)
function prependOnceListener(event: "close", listener: () => void): this
参数
- event
-
"close"
- listener
-
() => void
返回
this
prependOnceListener("data", (chunk: any) => void)
function prependOnceListener(event: "data", listener: (chunk: any) => void): this
参数
- event
-
"data"
- listener
-
(chunk: any) => void
返回
this
prependOnceListener("end", () => void)
function prependOnceListener(event: "end", listener: () => void): this
参数
- event
-
"end"
- listener
-
() => void
返回
this
prependOnceListener("error", (err: Error) => void)
function prependOnceListener(event: "error", listener: (err: Error) => void): this
参数
- event
-
"error"
- listener
-
(err: Error) => void
返回
this
prependOnceListener("readable", () => void)
function prependOnceListener(event: "readable", listener: () => void): this
参数
- event
-
"readable"
- listener
-
() => void
返回
this
prependOnceListener(string | symbol, (args: any[]) => void)
function prependOnceListener(event: string | symbol, listener: (args: any[]) => void): this
参数
- event
-
string | symbol
- listener
-
(args: any[]) => void
返回
this
push(any, string)
function push(chunk: any, encoding?: string): boolean
参数
- chunk
-
any
- encoding
-
string
返回
boolean
rawListeners(string | symbol)
function rawListeners(event: string | symbol): Function[]
参数
- event
-
string | symbol
返回
Function[]
read(number)
function read(size?: number): any
参数
- size
-
number
返回
any
ref()
function ref(): any
返回
any
removeAllListeners(string | symbol)
function removeAllListeners(event?: string | symbol): this
参数
- event
-
string | symbol
返回
this
removeListener(string | symbol, (args: any[]) => void)
function removeListener(event: string | symbol, listener: (args: any[]) => void): this
参数
- event
-
string | symbol
- listener
-
(args: any[]) => void
返回
this
resume()
function resume(): this
返回
this
setDefaultEncoding(string)
function setDefaultEncoding(encoding: string): this
参数
- encoding
-
string
返回
this
setEncoding(string)
function setEncoding(encoding: string): this
参数
- encoding
-
string
返回
this
setKeepAlive(boolean, number)
function setKeepAlive(enable?: boolean, initialDelay?: number): this
参数
- enable
-
boolean
- initialDelay
-
number
返回
this
setMaxListeners(number)
function setMaxListeners(n: number): this
参数
- n
-
number
返回
this
setNoDelay(boolean)
function setNoDelay(noDelay?: boolean): this
参数
- noDelay
-
boolean
返回
this
setTimeout(number, () => void)
function setTimeout(timeout: number, callback?: () => void): this
参数
- timeout
-
number
- callback
-
() => void
返回
this
uncork()
function uncork()
unpipe(any)
function unpipe(destination?: any): this
参数
- destination
-
any
返回
this
unref()
function unref(): any
返回
any
unshift(any)
function unshift(chunk: any)
参数
- chunk
-
any
wrap(any)
function wrap(oldStream: any): this
参数
- oldStream
-
any
返回
this
write(any, (error: Error | null | undefined) => void)
function write(chunk: any, cb?: (error: Error | null | undefined) => void): boolean
参数
- chunk
-
any
- cb
-
(error: Error | null | undefined) => void
返回
boolean
write(any, string, (error: Error | null | undefined) => void)
function write(chunk: any, encoding?: string, cb?: (error: Error | null | undefined) => void): boolean
参数
- chunk
-
any
- encoding
-
string
- cb
-
(error: Error | null | undefined) => void
返回
boolean
write(any, string, Function)
function write(data: any, encoding?: string, callback?: Function)
参数
- data
-
any
- encoding
-
string
- callback
-
Function
write(string, Function)
function write(str: string, cb?: Function): boolean
参数
- str
-
string
- cb
-
Function
返回
boolean
write(string, string, Function)
function write(str: string, encoding?: string, cb?: Function): boolean
参数
- str
-
string
- encoding
-
string
- cb
-
Function
返回
boolean
write(string, string, string)
function write(str: string, encoding?: string, fd?: string): boolean
参数
- str
-
string
- encoding
-
string
- fd
-
string
返回
boolean
write(ValidBuffer)
write(ValidBuffer, (err?: Error) => void)
function write(buffer: ValidBuffer, cb?: (err?: Error) => void): boolean
参数
- buffer
- ValidBuffer
- cb
-
(err?: Error) => void
返回
boolean