Objective Systems, Inc.  
Home
About ASN.1
Products
Free Software
Documents
Services
Resources
Resellers
Customers
Careers
About Us
Contact Us
 

Google


Objective Systems, Inc.

rtxCppSocket.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2003-2006 Objective Systems, Inc.
00003  *
00004  * This software is furnished under a license and may be used and copied
00005  * only in accordance with the terms of such license and with the
00006  * inclusion of the above copyright notice. This software or any other
00007  * copies thereof may not be provided or otherwise made available to any
00008  * other person. No title to and ownership of the software is hereby
00009  * transferred.
00010  *
00011  * The information in this software is subject to change without notice
00012  * and should not be construed as a commitment by Objective Systems, Inc.
00013  *
00014  * PROPRIETARY NOTICE
00015  *
00016  * This software is an unpublished work subject to a confidentiality agreement
00017  * and is protected by copyright and trade secret law.  Unauthorized copying,
00018  * redistribution or other use of this work is prohibited.
00019  *
00020  * The above notice of copyright on this source code product does not indicate
00021  * any actual or intended publication of such source code.
00022  *
00023  *****************************************************************************/
00024 
00029 #ifndef _RTXCPPSOCKET_H_
00030 #define _RTXCPPSOCKET_H_
00031 
00032 #include "rtxsrc/rtxCommon.h"
00033 #include "rtxsrc/rtxCppBaseType.h"
00034 #include "rtxsrc/rtxSocket.h"
00035 
00045 class EXTERNRTX OSSocketClass {
00046  private:
00047    int        mInitStatus;
00048    int        mStatus;
00049  protected:
00050    OSRTSOCKET mSocket;  
00051    OSBOOL     mOwner;   
00052 
00053    inline OSBOOL isInitialized () { return mInitStatus == 0; }
00054    inline int    initStatus ()    { return mInitStatus; }
00055  public:
00060    OSSocketClass ();
00061 
00071    OSSocketClass (OSRTSOCKET socket, OSBOOL ownership = FALSE);
00072    
00077    OSSocketClass (const OSSocketClass& socket);
00078    
00083    ~OSSocketClass ();
00084 
00100    OSSocketClass* accept (OSIPADDR* destIP = 0, int *port = 0);
00101 
00112    static const char* addrToString (OSIPADDR ipAddr, 
00113                                     char* pAddrStr, 
00114                                     int bufsize);
00115 
00130    int bind (OSIPADDR addr, int port);
00131 
00148    int bind (const char* pAddrStr, int port);
00149 
00163    inline int bind (int port) {
00164       return bind (OSIPADDR_ANY, port);
00165    }
00166 
00175    int close ();
00176 
00192    int connect (const char* host, int port);
00193 
00201    inline int getStatus () { return mStatus; }
00202 
00208    OSRTSOCKET getSocket () const { return mSocket; }
00209 
00221    int listen (int maxConnections);
00222 
00236    int recv (OSOCTET* pbuf, int bufsize);
00237 
00250    int send (const OSOCTET* pdata, int size);
00251 
00266    static int stringToAddr (const char* pAddrStr, OSIPADDR& ipAddr);
00267 } ;
00268 
00270 #endif //_RTXCPPSOCKET_H_

This file was last modified on 8 Jan 2007.
XBinder, Version 1.1.9