Oracle Coherence for C++ API
Release 3.6.1.0
E18813-01

- Main Page
- Namespaces
- Classes
- Files

# coherence/net/InetSocketAddress.hpp

    00001 /*
    00002 * InetSocketAddress.hpp
    00003 *
    00004 * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    00005 *
    00006 * Oracle is a registered trademarks of Oracle Corporation and/or its
    00007 * affiliates.
    00008 *
    00009 * This software is the confidential and proprietary information of Oracle
    00010 * Corporation. You shall not disclose such confidential and proprietary
    00011 * information and shall use it only in accordance with the terms of the
    00012 * license agreement you entered into with Oracle.
    00013 *
    00014 * This notice may not be removed or altered.
    00015 */
    00016 #ifndef COH_INET_SOCKET_ADDRESS_HPP
    00017 #define COH_INET_SOCKET_ADDRESS_HPP
    00018
    00019 #include "coherence/lang.ns"
    00020
    00021 #include "coherence/net/InetAddress.hpp"
    00022 #include "coherence/net/SocketAddress.hpp"
    00023
    00024 #include <ostream>
    00025
    00026 COH_OPEN_NAMESPACE2(coherence,net)
    00027
    00028
    00029 /**
    00030 * InetSocketAddress represents an endpoint of a IP socket connection.
    00031 *
    00032 * @author mf  2008.03.13
    00033 */
    00034 class COH_EXPORT InetSocketAddress
    00035     : public abstract_spec<InetSocketAddress,
    00036         extends<Object>,
    00037         implements<SocketAddress> >
    00038     {
    00039     friend class factory<InetSocketAddress>;
    00040
    00041     // ----- factory methods ------------------------------------------------
    00042
    00043     public:
    00044         /**
    00045         * Create a new InetSocketAddress.
    00046         *
    00047         * @param vAddr  the IP address of the endpoint
    00048         * @param nPort  the port of the endpoint
    00049         *
    00050         * @return a new InetSocketAddress
    00051         */
    00052         static InetSocketAddress::Handle create(InetAddress::View vAddr,
    00053                 uint16_t nPort);
    00054
    00055         /**
    00056         * Create a new InetSocketAddress.
    00057         *
    00058         * @param vsHost    the host name of the endpoint
    00059         * @param nPort     the port of the endpoint
    00060         * @param fResolve  specifies if the hostname should be resolved
    00061         *
    00062         * @return a new InetSocketAddress
    00063         */
    00064         static InetSocketAddress::Handle create(String::View vsHost,
    00065                 uint16_t nPort, bool fResolve = true);
    00066
    00067
    00068     // ----- InetSocketAddress interface ------------------------------------
    00069
    00070     public:
    00071         /**
    00072         * Return the associated InetAddress.
    00073         *
    00074         * @return the associated InetAddress.
    00075         */
    00076         virtual InetAddress::View getAddress() const = 0;
    00077
    00078         /**
    00079         * Return the associated port.
    00080         *
    00081         * @return the associated port
    00082         */
    00083         virtual uint16_t getPort() const = 0;
    00084
    00085         /**
    00086         * Return the hostname associated with the InetAddress.
    00087         *
    00088         * @return the associated hostname
    00089         */
    00090         virtual String::View getHostName() const = 0;
    00091
    00092
    00093     // ----- Object interface -----------------------------------------------
    00094
    00095     public:
    00096         /**
    00097         * {@inheritDoc}
    00098         */
    00099         virtual void toStream(std::ostream& out) const;
    00100         };
    00101
    00102 COH_CLOSE_NAMESPACE2
    00103
    00104 #endif // COH_INET_SOCKET_ADDRESS_HPP

Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.