class NetSocket extends ReadStream[Buffer] with WriteStream[Buffer]
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 io.vertx.scala.core.net.NetClient when a connection to a server is made, or on the server side by a io.vertx.scala.core.net.NetServer when a server accepts a connection.
It implements both and so it can be used with io.vertx.scala.core.streams.Pump to pump data with flow control.
- Alphabetic
- By Inheritance
- NetSocket
- WriteStream
- ReadStream
- StreamBase
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-  new NetSocket(_asJava: AnyRef)
Value Members
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        !=(arg0: Any): Boolean
      
      
      - Definition Classes
- AnyRef → Any
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        ##(): Int
      
      
      - Definition Classes
- AnyRef → Any
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        ==(arg0: Any): Boolean
      
      
      - Definition Classes
- AnyRef → Any
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        asInstanceOf[T0]: T0
      
      
      - Definition Classes
- Any
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        asJava: AnyRef
      
      
      - Definition Classes
- NetSocket → WriteStream → ReadStream → StreamBase
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        clone(): AnyRef
      
      
      - Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        close(): Unit
      
      
      Close the NetSocket 
- 
      
      
      
        
      
    
      
        
        def
      
      
        closeHandler(handler: Handler[Unit]): NetSocket
      
      
      Set a handler that will be called when the NetSocket is closed * @param handler the handler Set a handler that will be called when the NetSocket is closed * @param handler the handler - returns
- a reference to this, so the API can be used fluently 
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        drainHandler(handler: Handler[Unit]): NetSocket
      
      
      Set a drain handler on the stream. Set a drain handler on the stream. If the write queue is full, then the handler will be called when the write queue is ready to accept buffers again. See io.vertx.scala.core.streams.Pump for an example of this being used. The stream implementation defines when the drain handler, for example it could be when the queue size has been reduced to maxSize / 2. * @param handler the handler- returns
- a reference to this, so the API can be used fluently 
 - Definition Classes
- NetSocket → WriteStream
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        end(): Unit
      
      
      Calls io.vertx.scala.core.net.NetSocket#close - Definition Classes
- NetSocket → WriteStream
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        end(t: Buffer): Unit
      
      
      Same as io.vertx.scala.core.net.NetSocket#end but writes some data to the stream before ending. Same as io.vertx.scala.core.net.NetSocket#end but writes some data to the stream before ending. - Definition Classes
- NetSocket → WriteStream
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        endHandler(endHandler: Handler[Unit]): NetSocket
      
      
      This handler might be called after the close handler when the socket is paused and there are still buffers to deliver. This handler might be called after the close handler when the socket is paused and there are still buffers to deliver. - Definition Classes
- NetSocket → ReadStream
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        eq(arg0: AnyRef): Boolean
      
      
      - Definition Classes
- AnyRef
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        equals(arg0: Any): Boolean
      
      
      - Definition Classes
- AnyRef → Any
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        exceptionHandler(handler: Handler[Throwable]): NetSocket
      
      
      Set an exception handler on the write stream. Set an exception handler on the write stream. * @param handler the exception handler - returns
- a reference to this, so the API can be used fluently 
 - Definition Classes
- NetSocket → WriteStream → ReadStream → StreamBase
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        fetch(amount: Long): NetSocket
      
      
      Fetch the specified amountof elements.Fetch the specified amountof elements. If theReadStreamhas been paused, reading will recommence with the specifiedamountof items, otherwise the specifiedamountwill be added to the current stream demand. * @return a reference to this, so the API can be used fluently- Definition Classes
- NetSocket → ReadStream
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        finalize(): Unit
      
      
      - Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        getClass(): Class[_]
      
      
      - Definition Classes
- AnyRef → Any
- Annotations
- @native()
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        handler(handler: Handler[Buffer]): NetSocket
      
      
      Set a data handler. Set a data handler. As data is read, the handler will be called with the data. * @return a reference to this, so the API can be used fluently - Definition Classes
- NetSocket → ReadStream
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        hashCode(): Int
      
      
      - Definition Classes
- AnyRef → Any
- Annotations
- @native()
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        indicatedServerName(): String
      
      
      Returns the SNI server name presented during the SSL handshake by the client. Returns the SNI server name presented during the SSL handshake by the client. * @return the indicated server name 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        isInstanceOf[T0]: Boolean
      
      
      - Definition Classes
- Any
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        isSsl(): Boolean
      
      
      - returns
- true if this io.vertx.scala.core.net.NetSocket is encrypted via SSL/TLS. 
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        localAddress(): SocketAddress
      
      
      - returns
- the local address for this socket 
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        ne(arg0: AnyRef): Boolean
      
      
      - Definition Classes
- AnyRef
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        notify(): Unit
      
      
      - Definition Classes
- AnyRef
- Annotations
- @native()
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        notifyAll(): Unit
      
      
      - Definition Classes
- AnyRef
- Annotations
- @native()
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        pause(): NetSocket
      
      
      Pause the ReadStream, it sets the buffer infetchmode and clears the actual demand.Pause the ReadStream, it sets the buffer infetchmode and clears the actual demand.While it's paused, no data will be sent to the data handler. * @return a reference to this, so the API can be used fluently- Definition Classes
- NetSocket → ReadStream
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        remoteAddress(): SocketAddress
      
      
      - returns
- the remote address for this socket 
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        resume(): NetSocket
      
      
      Resume reading, and sets the buffer in flowingmode.Resume reading, and sets the buffer in flowingmode.If the ReadStreamhas been paused, reading will recommence on it. * @return a reference to this, so the API can be used fluently- Definition Classes
- NetSocket → ReadStream
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        sendFile(filename: String, offset: Long, length: Long, resultHandler: Handler[AsyncResult[Unit]]): NetSocket
      
      
      Same as io.vertx.scala.core.net.NetSocket#sendFile but also takes a handler that will be called when the send has completed or a failure has occurred * @param filename file name of the file to send Same as io.vertx.scala.core.net.NetSocket#sendFile but also takes a handler that will be called when the send has completed or a failure has occurred * @param filename file name of the file to send - offset
- offset 
- length
- length 
- resultHandler
- handler 
- returns
- a reference to this, so the API can be used fluently 
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        sendFile(filename: String, offset: Long, resultHandler: Handler[AsyncResult[Unit]]): NetSocket
      
      
      Same as io.vertx.scala.core.net.NetSocket#sendFile but also takes a handler that will be called when the send has completed or a failure has occurred * @param filename file name of the file to send Same as io.vertx.scala.core.net.NetSocket#sendFile but also takes a handler that will be called when the send has completed or a failure has occurred * @param filename file name of the file to send - offset
- offset 
- resultHandler
- handler 
- returns
- a reference to this, so the API can be used fluently 
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        sendFile(filename: String, resultHandler: Handler[AsyncResult[Unit]]): NetSocket
      
      
      Same as io.vertx.scala.core.net.NetSocket#sendFile but also takes a handler that will be called when the send has completed or a failure has occurred * @param filename file name of the file to send Same as io.vertx.scala.core.net.NetSocket#sendFile but also takes a handler that will be called when the send has completed or a failure has occurred * @param filename file name of the file to send - resultHandler
- handler 
- returns
- a reference to this, so the API can be used fluently 
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        sendFile(filename: String, offset: Long, length: Long): NetSocket
      
      
      Tell the operating system to stream a file as specified by filenamedirectly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system.Tell the operating system to stream a file as specified by filenamedirectly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system. This is a very efficient way to stream files. * @param filename file name of the file to send- offset
- offset 
- length
- length 
- returns
- a reference to this, so the API can be used fluently 
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        sendFile(filename: String, offset: Long): NetSocket
      
      
      Tell the operating system to stream a file as specified by filenamedirectly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system.Tell the operating system to stream a file as specified by filenamedirectly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system. This is a very efficient way to stream files. * @param filename file name of the file to send- offset
- offset 
- returns
- a reference to this, so the API can be used fluently 
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        sendFile(filename: String): NetSocket
      
      
      Tell the operating system to stream a file as specified by filenamedirectly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system.Tell the operating system to stream a file as specified by filenamedirectly from disk to the outgoing connection, bypassing userspace altogether (where supported by the underlying operating system. This is a very efficient way to stream files. * @param filename file name of the file to send- returns
- a reference to this, so the API can be used fluently 
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        sendFileFuture(filename: String, offset: Long, length: Long): scala.concurrent.Future[Unit]
      
      
      Like sendFile but returns a scala.concurrent.Future instead of taking an AsyncResultHandler. 
- 
      
      
      
        
      
    
      
        
        def
      
      
        sendFileFuture(filename: String, offset: Long): scala.concurrent.Future[Unit]
      
      
      Like sendFile but returns a scala.concurrent.Future instead of taking an AsyncResultHandler. 
- 
      
      
      
        
      
    
      
        
        def
      
      
        sendFileFuture(filename: String): scala.concurrent.Future[Unit]
      
      
      Like sendFile but returns a scala.concurrent.Future instead of taking an AsyncResultHandler. 
- 
      
      
      
        
      
    
      
        
        def
      
      
        setWriteQueueMaxSize(maxSize: Int): NetSocket
      
      
      Set the maximum size of the write queue to maxSize.Set the maximum size of the write queue to maxSize. You will still be able to write to the stream even if there is more thanmaxSizeitems in the write queue. This is used as an indicator by classes such asPumpto provide flow control.The value is defined by the implementation of the stream, e.g in bytes for a io.vertx.scala.core.net.NetSocket, the number of io.vertx.scala.core.eventbus.Message for a io.vertx.scala.core.eventbus.MessageProducer, etc... * @param maxSize the max size of the write stream - returns
- a reference to this, so the API can be used fluently 
 - Definition Classes
- NetSocket → WriteStream
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        synchronized[T0](arg0: ⇒ T0): T0
      
      
      - Definition Classes
- AnyRef
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        toString(): String
      
      
      - Definition Classes
- AnyRef → Any
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        upgradeToSsl(serverName: String, handler: Handler[Unit]): NetSocket
      
      
      Upgrade channel to use SSL/TLS. Upgrade channel to use SSL/TLS. Be aware that for this to work SSL must be configured. * @param serverName the server name - handler
- the handler will be notified when it's upgraded 
- returns
- a reference to this, so the API can be used fluently 
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        upgradeToSsl(handler: Handler[Unit]): NetSocket
      
      
      Upgrade channel to use SSL/TLS. Upgrade channel to use SSL/TLS. Be aware that for this to work SSL must be configured. * @param handler the handler will be notified when it's upgraded - returns
- a reference to this, so the API can be used fluently 
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        wait(): Unit
      
      
      - Definition Classes
- AnyRef
- Annotations
- @throws( ... )
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        wait(arg0: Long, arg1: Int): Unit
      
      
      - Definition Classes
- AnyRef
- Annotations
- @throws( ... )
 
- 
      
      
      
        
      
    
      
        final 
        def
      
      
        wait(arg0: Long): Unit
      
      
      - Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        write(message: Buffer, handler: Handler[AsyncResult[Unit]]): NetSocket
      
      
      Like but with an handlercalled when the message has been written or failed to be written.
- 
      
      
      
        
      
    
      
        
        def
      
      
        write(str: String, enc: String): NetSocket
      
      
      Write a String to the connection, encoded using the encoding enc.Write a String to the connection, encoded using the encoding enc. * @param str the string to write- enc
- the encoding to use 
- returns
- a reference to this, so the API can be used fluently 
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        write(str: String): NetSocket
      
      
      Write a String to the connection, encoded in UTF-8. Write a String to the connection, encoded in UTF-8. * @param str the string to write - returns
- a reference to this, so the API can be used fluently 
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        write(data: Buffer): NetSocket
      
      
      Write some data to the stream. 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 io.vertx.scala.core.streams.WriteStream#writeQueueFull method before writing. This is done automatically if using a io.vertx.scala.core.streams.Pump. * @param data the data to write - returns
- a reference to this, so the API can be used fluently 
 - Definition Classes
- NetSocket → WriteStream
 
- 
      
      
      
        
      
    
      
        
        def
      
      
        writeFuture(message: Buffer): scala.concurrent.Future[Unit]
      
      
      Like write but returns a scala.concurrent.Future instead of taking an AsyncResultHandler. 
- 
      
      
      
        
      
    
      
        
        def
      
      
        writeHandlerID(): String
      
      
      When a NetSocketis created it automatically registers an event handler with the event bus, the ID of that handler is given bywriteHandlerID.When a NetSocketis created it automatically registers an event handler with the event bus, the ID of that handler is given bywriteHandlerID.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. * @return the write handler ID 
- 
      
      
      
        
      
    
      
        
        def
      
      
        writeQueueFull(): Boolean
      
      
      This will return trueif there are more bytes in the write queue than the value set using io.vertx.scala.core.net.NetSocket#setWriteQueueMaxSize * @return true if write queue is fullThis will return trueif there are more bytes in the write queue than the value set using io.vertx.scala.core.net.NetSocket#setWriteQueueMaxSize * @return true if write queue is full- Definition Classes
- NetSocket → WriteStream