Represents a socket-like interface to a TCP connection on either the client or the server side.
Instances of this class are created on the client side by an NetClient when a connection to a server is made, or on the server side by a NetServer when a server accepts a connection.
It implements both and so it can be used with Pump to pump data with flow control.
Anything
no subtypes hierarchy
Initializer |
NetSocket(NetSocket unknown) |
Inherited Attributes |
Attributes inherited from: Object hash , string |
Methods | |
close | shared default void close() Close the NetSocket |
closeHandler | shared default NetSocket closeHandler(Anything()? handler) Set a handler that will be called when the NetSocket is closed Parameters:
|
drainHandler | shared actual default NetSocket drainHandler(Anything()? handler) Set a drain handler on the stream. If the write queue is full, then the handler will be called when the write queue has been reduced to maxSize / 2. See Pump for an example of this being used. Refines WriteStream.drainHandler |
end | shared actual default void end() Calls close Refines WriteStream.end |
end | shared actual default void end(Buffer t) Same as end but writes some data to the stream before ending. Refines WriteStream.end |
endHandler | shared actual default NetSocket endHandler(Anything()? endHandler) Set an end handler. Once the stream has ended, and there is no more data to be read, this handler will be called. Refines ReadStream.endHandler |
exceptionHandler | shared actual default NetSocket exceptionHandler(Anything(Throwable)? handler) Set an exception handler. Refines StreamBase.exceptionHandler |
handler | shared actual default NetSocket handler(Anything(Buffer)? handler) Set a data handler. As data is read, the handler will be called with the data. Refines ReadStream.handler |
isSsl | shared default Boolean isSsl() @return true if this NetSocket is encrypted via SSL/TLS. |
localAddress | shared default SocketAddress localAddress() @return the local address for this socket |
pause | shared actual default NetSocket pause() Pause the Refines ReadStream.pause |
remoteAddress | shared default SocketAddress remoteAddress() @return the remote address for this socket |
resume | shared actual default NetSocket resume() Resume reading. If the Refines ReadStream.resume |
sendFile | shared default NetSocket sendFile(String filename) Tell the operating system to stream a file as specified by Parameters:
|
sendFile | shared default NetSocket sendFile(String filename, Anything(Throwable?) resultHandler) Same as sendFile but also takes a handler that will be called when the send has completed or a failure has occurred Parameters:
|
sendFile | shared default NetSocket sendFile(String filename, Integer offset) Tell the operating system to stream a file as specified by Parameters:
|
sendFile | shared default NetSocket sendFile(String filename, Integer offset, Anything(Throwable?) resultHandler) Same as sendFile but also takes a handler that will be called when the send has completed or a failure has occurred Parameters:
|
sendFile | shared default NetSocket sendFile(String filename, Integer offset, Integer length) Tell the operating system to stream a file as specified by Parameters:
|
sendFile | shared default NetSocket sendFile(String filename, Integer offset, Integer length, Anything(Throwable?) resultHandler) Same as sendFile but also takes a handler that will be called when the send has completed or a failure has occurred Parameters:
|
setWriteQueueMaxSize | shared actual default NetSocket setWriteQueueMaxSize(Integer maxSize) Set the maximum size of the write queue to Refines WriteStream.setWriteQueueMaxSize |
upgradeToSsl | shared default NetSocket upgradeToSsl(Anything() handler) Upgrade channel to use SSL/TLS. Be aware that for this to work SSL must be configured. Parameters:
|
write | shared actual default NetSocket write(Buffer data) Write some data to the stream. The data is put on an internal write queue, and the write actually happens asynchronously. To avoid running out of memory by putting too much on the write queue, check the writeQueueFull method before writing. This is done automatically if using a Pump. Refines WriteStream.write |
write | shared default NetSocket write(String str) Write a Parameters:
|
write | shared default NetSocket write(String str, String enc) Write a Parameters:
|
writeHandlerID | shared default String writeHandlerID() When a Given this ID, a different event loop can send a buffer to that event handler using the event bus and that buffer will be received by this instance in its own event loop and written to the underlying connection. This allows you to write data to other connections which are owned by different event loops. |
writeQueueFull | shared actual default Boolean writeQueueFull() This will return Refines WriteStream.writeQueueFull |
Inherited Methods |
Methods inherited from: Object equals |
Methods inherited from: ReadStream<T> |
Methods inherited from: StreamBase |
Methods inherited from: WriteStream<T> |