Main Page   Packages   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

C:/temp/src/j2k/Net/TcpSocket.hpp

Go to the documentation of this file.
00001 // Wolf for J2K Library
00002 // LGPL Licensed.
00003 // http://j2k.sourceforge.net/
00004 // Revision #1: Fred P. - Oct 2nd, 2001
00005 
00006 #ifndef __J2K__NET__TCPSOCKET_HPP__
00007 #define __J2K__NET__TCPSOCKET_HPP__
00008 
00009 //This class is the java.net Socket class. It implements TCP/IP stream sockets.
00010 
00011 #include <j2k/Net/include.hpp>
00012 #include <j2k/Net/Socket.hpp>
00013 #include <j2k/Net/InetAddress.hpp>
00014 
00015 class TcpSocket : public Socket {
00016 
00017  public:
00018   TcpSocket(int port = 0) throw(int);
00019   TcpSocket(Socket &original) throw(int);
00020 //  TcpSocket(TcpSocket &original) throw(int);
00021   TcpSocket(InetAddress& address, int port = 0) throw(int); //Let system select port by default;
00022   TcpSocket(InetAddress& remoteAddr, int remotePort, InetAddress& localAddress, int localPort) throw(int);
00023 #ifdef USE_JSTRING
00024   TcpSocket(JString &host, int port) throw(int);
00025   TcpSocket(JString &remoteHost, int remotePort, InetAddress& localHost, int localPort) throw(int);
00026 
00027   JString getLocalHost() const;
00028   JString getHost() const;
00029 #else
00030   TcpSocket(char *host, int port) throw(int);
00031   TcpSocket(char *remoteHost, int remotePort, InetAddress& localHost, int localPort) throw(int);
00032 
00033   const char* getLocalHost() const;
00034   const char* getHost()      const;
00035 #endif
00036   InetAddress getLocalAddress() const;
00037   InetAddress getInetAddress()  const;
00038   int getLocalPort() const;
00039   int getPort()      const;
00040 
00041   
00042   //return 0 on success, set errno and return -1 on fail.
00043 
00044   int setTcpNoDelay(BOOL on);
00045   int setSoLinger(BOOL on, int linger);
00046   int setSoTimeout(int timeout);
00047   int setSendBufferSize(int size);
00048   int setRecieveBufferSize(int size);
00049   int setKeepAlive(BOOL on);
00050   
00051   // remember to check errno on fail
00052   BOOL getTcpNoDelay();
00053   int getSoLinger();
00054   int getSoTimeout();
00055   int getSendBufferSize();
00056   int getRecieveBufferSize();
00057   BOOL getKeepAlive();
00058 /*
00059   JString toString();
00060   int bind(int port = 0);
00061   int bind(InetAddress& addr, int port);
00062   int connect(InetAddress& adress, int port);
00063 */
00064 
00065   int read(char * buffer, size_t len, int flags = 0);
00066   int send(char * buffer, size_t len, int flags = 0);
00067 
00068  
00069  protected:
00070   InetAddress *remoteAddress;
00071   int remotePort;
00072   int localPort;
00073   
00074 };
00075 
00076 #endif //__J2K__NET__TCPSOCKET_HPP__

Generated on Sun Oct 14 18:46:33 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001