Socket.h

Go to the documentation of this file.
00001 #ifndef JAVA_NET_SOCKET_H
00002 #define JAVA_NET_SOCKET_H 1
00003 
00004 #ifndef JAVA_NET_SOCKETIMPL_H
00005 #include <java_net/SocketImpl.h>
00006 #endif /* JAVA_NET_SOCKETIMPL_H */
00007 #ifndef JAVA_NET_SOCKETIMPLFACTORY_H
00008 #include <java_net/SocketImplFactory.h>
00009 #endif /* JAVA_NET_SOCKETIMPLFACTORY_H */
00010 #ifndef JAVA_NET_SOCKETADDRESS_H
00011 #include <java_net/SocketAddress.h>
00012 #endif /* JAVA_NET_SOCKETADDRESS_H */
00013 #ifndef JAVA_NET_SPEC
00014 #include <java_net/Spec.h>
00015 #endif /* JAVA_NET_SPEC */
00016 
00017 namespace java {
00018   namespace net {
00019 
00038     class JAVA_NET_SPEC Socket : virtual public Object {
00039 
00040     public:
00041 
00064       static void setSocketImplFactory(const Ref<SocketImplFactory>& fac);
00065 
00073       Socket();
00074 
00107       Socket(const String& host, jint port);
00108 
00132       Socket(const Ref<InetAddress>& address, jint port);
00133 
00159       Socket(const String& host, jint port, const Ref<InetAddress>& localAddr, jint localPort = 0);
00160 
00181       Socket(const Ref<InetAddress>& address, jint port, const Ref<InetAddress>& localAddr, jint localPort = 0);
00182 
00191       virtual Ref<SocketImpl> getImpl() const;
00192 
00199       virtual jboolean isConnected() const;
00200 
00208       virtual jboolean isBound() const;
00209 
00217       virtual jboolean isClosed() const;
00218 
00226       virtual jboolean isInputShutdown() const;
00227 
00235       virtual jboolean isOutputShutdown() const;
00236 
00243       virtual Ref<InetAddress> getInetAddress() const;
00244 
00251       virtual jint getPort() const;
00252 
00261       virtual Ref<InetAddress> getLocalAddress() const;
00262 
00269       virtual jint getLocalPort() const;
00270 
00282       virtual Ref<SocketAddress> getRemoteSocketAddress() const;
00283 
00295       virtual Ref<SocketAddress> getLocalSocketAddress() const;
00296 
00314       virtual void connect(const Ref<SocketAddress>& endpoint, jint timeout = 0);
00315 
00331       virtual void bind(const Ref<SocketAddress>& bindpoint);
00332 
00375       virtual Ref<InputStream> getInputStream();
00376  
00392       virtual Ref<OutputStream> getOutputStream();
00393 
00407       virtual void setTcpNoDelay(jboolean on);
00408 
00418       virtual jboolean getTcpNoDelay() const;
00419   
00434       virtual void setSoLinger(jboolean on, jint linger);
00435 
00448       virtual jint getSoLinger() const;
00449 
00460       virtual void sendUrgentData(jint data);
00461 
00485       virtual void setOOBInline(jboolean on);
00486 
00496       virtual jboolean getOOBInline() const;
00497 
00514       virtual void setSoTimeout(jint timeout);
00515 
00525       virtual jint getSoTimeout() const;
00526 
00549       virtual void setSendBufferSize(jint size);
00550 
00563       virtual jint getSendBufferSize() const;
00564 
00604       virtual void setReceiveBufferSize(jint size);
00605 
00617       virtual jint getReceiveBufferSize() const;
00618 
00628       virtual void setKeepAlive(jboolean on);
00629 
00639       virtual jboolean getKeepAlive() const;
00640 
00677       virtual void setTrafficClass(jint tc);
00678 
00694       virtual jint getTrafficClass() const;
00695 
00730       virtual void setReuseAddress(jboolean on);
00731 
00741       virtual jboolean getReuseAddress() const;
00742 
00761       virtual void close();
00762 
00780       virtual void shutdownInput();
00781 
00800       virtual void shutdownOutput();
00801 
00807       virtual String toString() const;
00808 
00809     protected:
00810 
00822       Socket(const Ref<SocketImpl>& impl);
00823 
00828       virtual void setImpl();
00829 
00830       void init(const Ref<SocketAddress>& address, const Ref<SocketAddress>& localAddr);
00831 
00832     private:
00833 
00837       Ref<SocketImpl> impl;
00838 
00842       static Ref<SocketImplFactory> factory;
00843 
00844       REGISTER_MEMBERS;
00845 
00846     };
00847 
00848   } // namespace net
00849 } // namespace java
00850 
00851 #endif /* JAVA_NET_SOCKET_H */

Generated on Fri May 16 11:54:43 2008 for CrossPlatformJavaLikeC++API by  doxygen 1.5.3