Class Connection

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public class Connection
    extends java.lang.Object
    implements java.lang.AutoCloseable
    Represents an open connection to a specific 60870 server. It is created either through an instance of ClientConnectionBuilder or passed to ServerEventListener. Once it has been closed it cannot be opened again. A newly created connection has successfully build up a TCP/IP connection to the server. Before receiving ASDUs or sending commands one has to call startDataTransfer(). Afterwards incoming ASDUs are forwarded to the ConnectionEventListener. Incoming ASDUs are queued so that ConnectionEventListener.newASdu(Connection connection, ASdu) is never called simultaneously for the same connection.

    Connection offers a method for every possible command defined by IEC 60870 (e.g. singleCommand). Every command function may throw an IOException indicating a fatal connection error. In this case the connection will be automatically closed and a new connection will have to be built up. The command methods do not wait for an acknowledgment but return right after the command has been sent.

    • Method Detail

      • stopDataTransfer

        public void stopDataTransfer()
                              throws java.io.IOException
        Stops the data transfer. First sends S-Format to confirm unconfirmed I-Format messages, then sends a STOPDT act and waits for a STOPDT con. If successful the data transfer stops and releases the ASduListener. If no STOPDT con could be received, while t1, the connection will be closed.
        Throws:
        java.io.IOException
      • startDataTransfer

        public void startDataTransfer()
                               throws java.io.IOException
        Starts a connection. Sends a STARTDT act and waits for a STARTDT con. If successful a new thread will be started that listens for incoming ASDUs and notifies the given ASduListener.
        Throws:
        java.io.IOException - if any kind of IOException occurs.
      • setOriginatorAddress

        public void setOriginatorAddress​(int originatorAddress)
        Set the Originator Address. It is the address of controlling station (client) so that responses can be routed back to it. Originator addresses from 1 to 255 are used to address a particular controlling station. Address 0 is the default and is used if responses are to be routed to all controlling stations in the system. Note that the same Originator Address is sent in a command and its confirmation.
        Parameters:
        originatorAddress - the Originator Address. Valid values are 0...255.
      • getOriginatorAddress

        public int getOriginatorAddress()
        Get the configured Originator Address.
        Returns:
        the Originator Address
      • getNumUnconfirmedAPdusSent

        public int getNumUnconfirmedAPdusSent()
      • close

        public void close()
        Will close the TCP connection if it's still open and free any resources of this connection.
        Specified by:
        close in interface java.lang.AutoCloseable
      • isClosed

        public boolean isClosed()
        Returns true if connection is closed else false.
        Returns:
        true if closed
      • isStopped

        public boolean isStopped()
        Returns true if data transfer is stopped.
        Returns:
        true if stopped
      • send

        public void send​(ASdu aSdu)
                  throws java.io.IOException,
                         java.lang.IllegalArgumentException
        Throws:
        java.io.IOException
        java.lang.IllegalArgumentException
      • sendConfirmation

        public void sendConfirmation​(ASdu aSdu)
                              throws java.io.IOException
        Send response with given aSdu. Common ASDU address of given ASDU is used as station address.
        Parameters:
        aSdu - ASDU which response to
        Throws:
        java.io.IOException - if a fatal communication error occurred.
      • sendConfirmation

        public void sendConfirmation​(ASdu aSdu,
                                     int stationAddress)
                              throws java.io.IOException
        Send response with given aSdu. Given station address is used as Common ASDU Address, if we response to broadcast else given Common ASDU Address of aSdu.
        Parameters:
        aSdu - ASDU which response to
        stationAddress - address of this station
        Throws:
        java.io.IOException - if a fatal communication error occurred.
      • sendConfirmation

        public void sendConfirmation​(ASdu aSdu,
                                     int stationAddress,
                                     boolean isNegativeConfirm)
                              throws java.io.IOException
        Send response with given aSdu. Given station address is used as Common ASDU Address, if we response to broadcast else given Common ASDU Address of aSdu.
        Parameters:
        aSdu - ASDU which response to
        stationAddress - address of this station
        isNegativeConfirm - true if it is a negative confirmation
        Throws:
        java.io.IOException - if a fatal communication error occurred.
      • sendConfirmation

        public void sendConfirmation​(ASdu aSdu,
                                     int stationAddress,
                                     boolean isNegativeConfirm,
                                     CauseOfTransmission cot)
                              throws java.io.IOException
        Send response with given aSdu. Given station address is used as Common ASDU Address, if we response to broadcast else given Common ASDU Address of aSdu.
        Parameters:
        aSdu - ASDU which response to
        stationAddress - address of this station
        isNegativeConfirm - true if it is a negative confirmation
        cot - Cause of transmission, for e.g. negative confirm UNKNOWN_TYPE_ID(44), UNKNOWN_CAUSE_OF_TRANSMISSION(45), UNKNOWN_COMMON_ADDRESS_OF_ASDU(46) and UNKNOWN_INFORMATION_OBJECT_ADDRESS(47)
        Throws:
        java.io.IOException - if a fatal communication error occurred.
      • sendActivationTermination

        public void sendActivationTermination​(ASdu aSdu,
                                              int stationAddress)
                                       throws java.io.IOException
        Send activation termination with given aSdu. Given station address is used as Common ASDU Address, if we response to broadcast else given Common ASDU Address of aSdu.
        Parameters:
        aSdu - ASDU which response to
        stationAddress - address of this station
        Throws:
        java.io.IOException - if a fatal communication error occurred.
      • sendActivationTermination

        public void sendActivationTermination​(ASdu aSdu)
                                       throws java.io.IOException
        Send activation termination with given aSdu. Common ASDU address of given ASDU is used as station address.
        Parameters:
        aSdu - ASDU which response to
        Throws:
        java.io.IOException - if a fatal communication error occurred.
      • singleCommand

        public void singleCommand​(int commonAddress,
                                  CauseOfTransmission cot,
                                  int informationObjectAddress,
                                  IeSingleCommand singleCommand)
                           throws java.io.IOException
        Sends a single command (C_SC_NA_1, TI: 45).
        Parameters:
        commonAddress - the Common ASDU Address. Valid value are 1...255 or 1...65535 for field lengths 1 or 2 respectively.
        cot - the cause of transmission. Allowed are activation and deactivation.
        informationObjectAddress - the information object address.
        singleCommand - the command to be sent.
        Throws:
        java.io.IOException - if a fatal communication error occurred.
      • singleCommandWithTimeTag

        public void singleCommandWithTimeTag​(int commonAddress,
                                             CauseOfTransmission cot,
                                             int informationObjectAddress,
                                             IeSingleCommand singleCommand,
                                             IeTime56 timeTag)
                                      throws java.io.IOException
        Sends a single command with time tag CP56Time2a (C_SC_TA_1, TI: 58).
        Parameters:
        commonAddress - the Common ASDU Address. Valid value are 1...255 or 1...65535 for field lengths 1 or 2 respectively.
        cot - the cause of transmission. Allowed are activation and deactivation.
        informationObjectAddress - the information object address.
        singleCommand - the command to be sent.
        timeTag - the time tag to be sent.
        Throws:
        java.io.IOException - if a fatal communication error occurred.
      • doubleCommand

        public void doubleCommand​(int commonAddress,
                                  CauseOfTransmission cot,
                                  int informationObjectAddress,
                                  IeDoubleCommand doubleCommand)
                           throws java.io.IOException
        Sends a double command (C_DC_NA_1, TI: 46).
        Parameters:
        commonAddress - the Common ASDU Address. Valid value are 1...255 or 1...65535 for field lengths 1 or 2 respectively.
        cot - the cause of transmission. Allowed are activation and deactivation.
        informationObjectAddress - the information object address.
        doubleCommand - the command to be sent.
        Throws:
        java.io.IOException - if a fatal communication error occurred.
      • doubleCommandWithTimeTag

        public void doubleCommandWithTimeTag​(int commonAddress,
                                             CauseOfTransmission cot,
                                             int informationObjectAddress,
                                             IeDoubleCommand doubleCommand,
                                             IeTime56 timeTag)
                                      throws java.io.IOException
        Sends a double command with time tag CP56Time2a (C_DC_TA_1, TI: 59).
        Parameters:
        commonAddress - the Common ASDU Address. Valid value are 1...255 or 1...65535 for field lengths 1 or 2 respectively.
        cot - the cause of transmission. Allowed are activation and deactivation.
        informationObjectAddress - the information object address.
        doubleCommand - the command to be sent.
        timeTag - the time tag to be sent.
        Throws:
        java.io.IOException - if a fatal communication error occurred.
      • regulatingStepCommand

        public void regulatingStepCommand​(int commonAddress,
                                          CauseOfTransmission cot,
                                          int informationObjectAddress,
                                          IeRegulatingStepCommand regulatingStepCommand)
                                   throws java.io.IOException
        Sends a regulating step command (C_RC_NA_1, TI: 47).
        Parameters:
        commonAddress - the Common ASDU Address. Valid value are 1...255 or 1...65535 for field lengths 1 or 2 respectively.
        cot - the cause of transmission. Allowed are activation and deactivation.
        informationObjectAddress - the information object address.
        regulatingStepCommand - the command to be sent.
        Throws:
        java.io.IOException - if a fatal communication error occurred.
      • regulatingStepCommandWithTimeTag

        public void regulatingStepCommandWithTimeTag​(int commonAddress,
                                                     CauseOfTransmission cot,
                                                     int informationObjectAddress,
                                                     IeRegulatingStepCommand regulatingStepCommand,
                                                     IeTime56 timeTag)
                                              throws java.io.IOException
        Sends a regulating step command with time tag CP56Time2a (C_RC_TA_1, TI: 60).
        Parameters:
        commonAddress - the Common ASDU Address. Valid value are 1...255 or 1...65535 for field lengths 1 or 2 respectively.
        cot - the cause of transmission. Allowed are activation and deactivation.
        informationObjectAddress - the information object address.
        regulatingStepCommand - the command to be sent.
        timeTag - the time tag to be sent.
        Throws:
        java.io.IOException - if a fatal communication error occurred.
      • setNormalizedValueCommand

        public void setNormalizedValueCommand​(int commonAddress,
                                              CauseOfTransmission cot,
                                              int informationObjectAddress,
                                              IeNormalizedValue normalizedValue,
                                              IeQualifierOfSetPointCommand qualifier)
                                       throws java.io.IOException
        Sends a set-point command, normalized value (C_SE_NA_1, TI: 48).
        Parameters:
        commonAddress - the Common ASDU Address. Valid value are 1...255 or 1...65535 for field lengths 1 or 2 respectively.
        cot - the cause of transmission. Allowed are activation and deactivation.
        informationObjectAddress - the information object address.
        normalizedValue - the value to be sent.
        qualifier - the qualifier to be sent.
        Throws:
        java.io.IOException - if a fatal communication error occurred.
      • setNormalizedValueCommandWithTimeTag

        public void setNormalizedValueCommandWithTimeTag​(int commonAddress,
                                                         CauseOfTransmission cot,
                                                         int informationObjectAddress,
                                                         IeNormalizedValue normalizedValue,
                                                         IeQualifierOfSetPointCommand qualifier,
                                                         IeTime56 timeTag)
                                                  throws java.io.IOException
        Sends a set-point command with time tag CP56Time2a, normalized value (C_SE_TA_1, TI: 61).
        Parameters:
        commonAddress - the Common ASDU Address. Valid value are 1...255 or 1...65535 for field lengths 1 or 2 respectively.
        cot - the cause of transmission. Allowed are activation and deactivation.
        informationObjectAddress - the information object address.
        normalizedValue - the value to be sent.
        qualifier - the qualifier to be sent.executor
        timeTag - the time tag to be sent.
        Throws:
        java.io.IOException - if a fatal communication error occurred.
      • setScaledValueCommand

        public void setScaledValueCommand​(int commonAddress,
                                          CauseOfTransmission cot,
                                          int informationObjectAddress,
                                          IeScaledValue scaledValue,
                                          IeQualifierOfSetPointCommand qualifier)
                                   throws java.io.IOException
        Sends a set-point command, scaled value (C_SE_NB_1, TI: 49).
        Parameters:
        commonAddress - the Common ASDU Address. Valid value are 1...255 or 1...65535 for field lengths 1 or 2 respectively.
        cot - the cause of transmission. Allowed are activation and deactivation.
        informationObjectAddress - the information object address.
        scaledValue - the value to be sent.
        qualifier - the qualifier to be sent.
        Throws:
        java.io.IOException - if a fatal communication error occurred.
      • setScaledValueCommandWithTimeTag

        public void setScaledValueCommandWithTimeTag​(int commonAddress,
                                                     CauseOfTransmission cot,
                                                     int informationObjectAddress,
                                                     IeScaledValue scaledValue,
                                                     IeQualifierOfSetPointCommand qualifier,
                                                     IeTime56 timeTag)
                                              throws java.io.IOException
        Sends a set-point command with time tag CP56Time2a, scaled value (C_SE_TB_1, TI: 62).
        Parameters:
        commonAddress - the Common ASDU Address. Valid value are 1...255 or 1...65535 for field lengths 1 or 2 respectively.
        cot - the cause of transmission. Allowed are activation and deactivation.
        informationObjectAddress - the information object address.
        scaledValue - the value to be sent.
        qualifier - the qualifier to be sent.
        timeTag - the time tag to be sent.
        Throws:
        java.io.IOException - if a fatal communication error occurred.
      • setShortFloatCommand

        public void setShortFloatCommand​(int commonAddress,
                                         CauseOfTransmission cot,
                                         int informationObjectAddress,
                                         IeShortFloat floatVal,
                                         IeQualifierOfSetPointCommand qualifier)
                                  throws java.io.IOException
        Sends a set-point command, short floating point number (C_SE_NC_1, TI: 50).
        Parameters:
        commonAddress - the Common ASDU Address. Valid value are 1...255 or 1...65535 for field lengths 1 or 2 respectively.
        cot - the cause of transmission. Allowed are activation and deactivation.
        informationObjectAddress - the information object address.
        floatVal - the value to be sent.
        qualifier - the qualifier to be sent.
        Throws:
        java.io.IOException - if a fatal communication error occurred.
      • setShortFloatCommandWithTimeTag

        public void setShortFloatCommandWithTimeTag​(int commonAddress,
                                                    CauseOfTransmission cot,
                                                    int informationObjectAddress,
                                                    IeShortFloat shortFloat,
                                                    IeQualifierOfSetPointCommand qualifier,
                                                    IeTime56 timeTag)
                                             throws java.io.IOException
        Sends a set-point command with time tag CP56Time2a, short floating point number (C_SE_TC_1, TI: 63).
        Parameters:
        commonAddress - the Common ASDU Address. Valid value are 1...255 or 1...65535 for field lengths 1 or 2 respectively.
        cot - the cause of transmission. Allowed are activation and deactivation.
        informationObjectAddress - the information object address.
        shortFloat - the value to be sent.
        qualifier - the qualifier to be sent.
        timeTag - the time tag to be sent.
        Throws:
        java.io.IOException - if a fatal communication error occurred.
      • bitStringCommand

        public void bitStringCommand​(int commonAddress,
                                     CauseOfTransmission cot,
                                     int informationObjectAddress,
                                     IeBinaryStateInformation binaryStateInformation)
                              throws java.io.IOException
        Sends a bitstring of 32 bit (C_BO_NA_1, TI: 51).
        Parameters:
        commonAddress - the Common ASDU Address. Valid value are 1...255 or 1...65535 for field lengths 1 or 2 respectively.
        cot - the cause of transmission. Allowed are activation and deactivation.
        informationObjectAddress - the information object address.
        binaryStateInformation - the value to be sent.
        Throws:
        java.io.IOException - if a fatal communication error occurred.
      • bitStringCommandWithTimeTag

        public void bitStringCommandWithTimeTag​(int commonAddress,
                                                CauseOfTransmission cot,
                                                int informationObjectAddress,
                                                IeBinaryStateInformation binaryStateInformation,
                                                IeTime56 timeTag)
                                         throws java.io.IOException
        Sends a bitstring of 32 bit with time tag CP56Time2a (C_BO_TA_1, TI: 64).
        Parameters:
        commonAddress - the Common ASDU Address. Valid value are 1...255 or 1...65535 for field lengths 1 or 2 respectively.
        cot - the cause of transmission. Allowed are activation and deactivation.
        informationObjectAddress - the information object address.
        binaryStateInformation - the value to be sent.
        timeTag - the time tag to be sent.
        Throws:
        java.io.IOException - if a fatal communication error occurred.
      • interrogation

        public void interrogation​(int commonAddress,
                                  CauseOfTransmission cot,
                                  IeQualifierOfInterrogation qualifier)
                           throws java.io.IOException
        Sends an interrogation command (C_IC_NA_1, TI: 100).
        Parameters:
        commonAddress - the Common ASDU Address. Valid value are 1...255 or 1...65535 for field lengths 1 or 2 respectively.
        cot - the cause of transmission. Allowed are activation and deactivation.
        qualifier - the qualifier to be sent.
        Throws:
        java.io.IOException - if a fatal communication error occurred.
      • counterInterrogation

        public void counterInterrogation​(int commonAddress,
                                         CauseOfTransmission cot,
                                         IeQualifierOfCounterInterrogation qualifier)
                                  throws java.io.IOException
        Sends a counter interrogation command (C_CI_NA_1, TI: 101).
        Parameters:
        commonAddress - the Common ASDU Address. Valid value are 1...255 or 1...65535 for field lengths 1 or 2 respectively.
        cot - the cause of transmission. Allowed are activation and deactivation.
        qualifier - the qualifier to be sent.
        Throws:
        java.io.IOException - if a fatal communication error occurred.
      • readCommand

        public void readCommand​(int commonAddress,
                                int informationObjectAddress)
                         throws java.io.IOException
        Sends a read command (C_RD_NA_1, TI: 102).
        Parameters:
        commonAddress - the Common ASDU Address. Valid value are 1...255 or 1...65535 for field lengths 1 or 2 respectively.
        informationObjectAddress - the information object address.
        Throws:
        java.io.IOException - if a fatal communication error occurred.
      • synchronizeClocks

        public void synchronizeClocks​(int commonAddress,
                                      IeTime56 time)
                               throws java.io.IOException
        Sends a clock synchronization command (C_CS_NA_1, TI: 103).
        Parameters:
        commonAddress - the Common ASDU Address. Valid value are 1...255 or 1...65535 for field lengths 1 or 2 respectively.
        time - the time to be sent.
        Throws:
        java.io.IOException - if a fatal communication error occurred.
      • testCommand

        public void testCommand​(int commonAddress)
                         throws java.io.IOException
        Sends a test command (C_TS_NA_1, TI: 104).
        Parameters:
        commonAddress - the Common ASDU Address. Valid value are 1...255 or 1...65535 for field lengths 1 or 2 respectively.
        Throws:
        java.io.IOException - if a fatal communication error occurred.
      • resetProcessCommand

        public void resetProcessCommand​(int commonAddress,
                                        IeQualifierOfResetProcessCommand qualifier)
                                 throws java.io.IOException
        Sends a reset process command (C_RP_NA_1, TI: 105).
        Parameters:
        commonAddress - the Common ASDU Address. Valid value are 1...255 or 1...65535 for field lengths 1 or 2 respectively.
        qualifier - the qualifier to be sent.
        Throws:
        java.io.IOException - if a fatal communication error occurred.
      • delayAcquisitionCommand

        public void delayAcquisitionCommand​(int commonAddress,
                                            CauseOfTransmission cot,
                                            IeTime16 time)
                                     throws java.io.IOException
        Sends a delay acquisition command (C_CD_NA_1, TI: 106).
        Parameters:
        commonAddress - the Common ASDU Address. Valid value are 1...255 or 1...65535 for field lengths 1 or 2 respectively.
        cot - the cause of transmission. Allowed are activation and spontaneous.
        time - the time to be sent.
        Throws:
        java.io.IOException - if a fatal communication error occurred.
      • testCommandWithTimeTag

        public void testCommandWithTimeTag​(int commonAddress,
                                           IeTestSequenceCounter testSequenceCounter,
                                           IeTime56 time)
                                    throws java.io.IOException
        Sends a test command with time tag CP56Time2a (C_TS_TA_1, TI: 107).
        Parameters:
        commonAddress - the Common ASDU Address. Valid value are 1...255 or 1...65535 for field lengths 1 or 2 respectively.
        testSequenceCounter - the value to be sent.
        time - the time to be sent.
        Throws:
        java.io.IOException - if a fatal communication error occurred.
      • parameterNormalizedValueCommand

        public void parameterNormalizedValueCommand​(int commonAddress,
                                                    int informationObjectAddress,
                                                    IeNormalizedValue normalizedValue,
                                                    IeQualifierOfParameterOfMeasuredValues qualifier)
                                             throws java.io.IOException
        Sends a parameter of measured values, normalized value (P_ME_NA_1, TI: 110).
        Parameters:
        commonAddress - the Common ASDU Address. Valid value are 1...255 or 1...65535 for field lengths 1 or 2 respectively.
        informationObjectAddress - the information object address.
        normalizedValue - the value to be sent.
        qualifier - the qualifier to be sent.
        Throws:
        java.io.IOException - if a fatal communication error occurred.
      • parameterScaledValueCommand

        public void parameterScaledValueCommand​(int commonAddress,
                                                int informationObjectAddress,
                                                IeScaledValue scaledValue,
                                                IeQualifierOfParameterOfMeasuredValues qualifier)
                                         throws java.io.IOException
        Sends a parameter of measured values, scaled value (P_ME_NB_1, TI: 111).
        Parameters:
        commonAddress - the Common ASDU Address. Valid value are 1...255 or 1...65535 for field lengths 1 or 2 respectively.
        informationObjectAddress - the information object address.
        scaledValue - the value to be sent.
        qualifier - the qualifier to be sent.
        Throws:
        java.io.IOException - if a fatal communication error occurred.
      • parameterShortFloatCommand

        public void parameterShortFloatCommand​(int commonAddress,
                                               int informationObjectAddress,
                                               IeShortFloat shortFloat,
                                               IeQualifierOfParameterOfMeasuredValues qualifier)
                                        throws java.io.IOException
        Sends a parameter of measured values, short floating point number (P_ME_NC_1, TI: 112).
        Parameters:
        commonAddress - the Common ASDU Address. Valid value are 1...255 or 1...65535 for field lengths 1 or 2 respectively.
        informationObjectAddress - the information object address.
        shortFloat - the value to be sent.
        qualifier - the qualifier to be sent.
        Throws:
        java.io.IOException - if a fatal communication error occurred.
      • parameterActivation

        public void parameterActivation​(int commonAddress,
                                        CauseOfTransmission cot,
                                        int informationObjectAddress,
                                        IeQualifierOfParameterActivation qualifier)
                                 throws java.io.IOException
        Sends a parameter activation (P_AC_NA_1, TI: 113).
        Parameters:
        commonAddress - the Common ASDU Address. Valid value are 1...255 or 1...65535 for field lengths 1 or 2 respectively.
        cot - the cause of transmission. Allowed are activation and deactivation.
        informationObjectAddress - the information object address.
        qualifier - the qualifier to be sent.
        Throws:
        java.io.IOException - if a fatal communication error occurred.
      • sendSegment

        public void sendSegment​(int commonAddress,
                                int informationObjectAddress,
                                IeNameOfFile nameOfFile,
                                IeNameOfSection nameOfSection,
                                IeFileSegment segment)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • sendDirectory

        public void sendDirectory​(int commonAddress,
                                  int informationObjectAddress,
                                  InformationElement[][] directory)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • queryLog

        public void queryLog​(int commonAddress,
                             int informationObjectAddress,
                             IeNameOfFile nameOfFile,
                             IeTime56 rangeStartTime,
                             IeTime56 rangeEndTime)
                      throws java.io.IOException
        Throws:
        java.io.IOException
      • getRemoteInetAddress

        public java.net.InetAddress getRemoteInetAddress()
        Returns:
        the remote IP address to which the used socket is connected, or null if the socket is not connected.
        See Also:
        Socket.getInetAddress()
      • getLocalAddress

        public java.net.InetAddress getLocalAddress()
        Returns:
        the local address to which the used socket is bound, the loopback address if denied by the security manager, or the wildcard address if the socket is closed or not bound yet.
        See Also:
        Socket.getLocalAddress()
      • getRemoteSocketAddress

        public java.net.SocketAddress getRemoteSocketAddress()
        Returns:
        a SocketAddress representing the remote endpoint of the used socket, or null if it is not connected yet.
        See Also:
        Socket.getRemoteSocketAddress()
      • getLocalSocketAddress

        public java.net.SocketAddress getLocalSocketAddress()
        Returns:
        a SocketAddress representing the local endpoint of the used socket, or a SocketAddress representing the loopback address if denied by the security manager, or null if the socket is not bound yet.
        See Also:
        Socket.getLocalSocketAddress()
      • getPort

        public int getPort()
        Returns:
        the remote port number to which this socket is connected, or 0 if the socket is not connected yet.
      • getLocalPort

        public int getLocalPort()
        Returns:
        the local port number to which the used socket is bound or -1 if the socket is not bound yet.
        See Also:
        Socket.getLocalPort()
      • getClosedIOException

        public java.io.IOException getClosedIOException()