PlainSocketImpl.h

Go to the documentation of this file.
00001 #ifndef JAVA_NET_PLAINSOCKETIMPL_H
00002 #define JAVA_NET_PLAINSOCKETIMPL_H 1
00003 
00004 #ifndef JAVA_NET_SOCKETIMPL_H
00005 #include <java_net/SocketImpl.h>
00006 #endif /* JAVA_NET_SOCKETIMPL_H */
00007 #ifndef JAVA_LANG_SYNC_H
00008 #include <java_lang/Sync.h>
00009 #endif /* JAVA_LANG_SYNC_H */
00010 #ifndef JAVA_IO_FILEDESCRIPTOR_H
00011 #include <java_io/FileDescriptor.h>
00012 #endif /* JAVA_IO_FILEDESCRIPTOR_H */
00013 #ifndef JAVA_IO_INPUTSTREAM_H
00014 #include <java_io/InputStream.h>
00015 #endif /* JAVA_IO_INPUTSTREAM_H */
00016 #ifndef JAVA_IO_OUTPUTSTREAM_H
00017 #include <java_io/OutputStream.h>
00018 #endif /* JAVA_IO_OUTPUTSTREAM_H */
00019 #ifndef JAVA_NET_SPEC
00020 #include <java_net/Spec.h>
00021 #endif /* JAVA_NET_SPEC */
00022 
00023 namespace java {
00024   namespace net {
00025 
00026     using namespace java::io;
00027     
00036     class 
00037       PlainSocketImpl : virtual public SocketImpl {
00038 
00039     public:
00040 
00044       PlainSocketImpl(const Ref<FileDescriptor>& fd = 0);
00045       ~PlainSocketImpl();
00046 
00047       /*
00048        * Return the current value of SO_TIMEOUT
00049        */
00050       jint getTimeout() const;
00051 
00093       virtual void setOption(jint optID, const ObjectRef& value);
00094 
00128       virtual ObjectRef getOption(jint optID) const;
00129 
00138       virtual void create(jboolean stream);
00139   
00149       virtual void connect(const String& host, jint port, jint timeout = 0);
00150 
00160       virtual void connect(const Ref<InetAddress>& address, jint port, jint timeout = 0);
00161   
00169       virtual void bind(const Ref<InetAddress>& host, jint port);
00170 
00180       virtual void listen(jint backlog);
00181 
00189       virtual void accept(const Ref<SocketImpl>& s);
00190 
00198       virtual Ref<InputStream> getInputStream();
00199 
00207       virtual Ref<OutputStream> getOutputStream();
00208 
00218       virtual jint available();
00219 
00225       virtual void close();
00226 
00241       virtual void shutdownInput();
00242   
00258       virtual void shutdownOutput();
00259 
00269       virtual jboolean supportsUrgentData() const;
00270 
00279       virtual void sendUrgentData(jint data);
00280 
00281     protected:
00282 
00283       /* instance variable for SO_TIMEOUT */
00284       jint timeout; // timeout in millisec
00285       jint typeOfService; // type of service
00286       Sync sync;
00287 
00288     private:
00289 
00290       void doConnect(const Ref<InetAddress>& address, jint port, jint timeout);
00291 
00292       Ref<InputStream> socketInputStream;
00293       Ref<OutputStream> socketOutputStream;
00294       REGISTER_MEMBERS;
00295 
00296     };
00297 
00298   } // namespace net
00299 } // namespace java
00300 
00301 #endif /* JAVA_NET_PLAINSOCKETIMPL_H */

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