Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

TCP_Socket.h

Go to the documentation of this file.
00001 /* ****************************************************************** **
00002 **    OpenSees - Open System for Earthquake Engineering Simulation    **
00003 **          Pacific Earthquake Engineering Research Center            **
00004 **                                                                    **
00005 **                                                                    **
00006 ** (C) Copyright 1999, The Regents of the University of California    **
00007 ** All Rights Reserved.                                               **
00008 **                                                                    **
00009 ** Commercial use of this program without express permission of the   **
00010 ** University of California, Berkeley, is strictly prohibited.  See   **
00011 ** file 'COPYRIGHT'  in main directory for information on usage and   **
00012 ** redistribution,  and for a DISCLAIMER OF ALL WARRANTIES.           **
00013 **                                                                    **
00014 ** Developed by:                                                      **
00015 **   Frank McKenna (fmckenna@ce.berkeley.edu)                         **
00016 **   Gregory L. Fenves (fenves@ce.berkeley.edu)                       **
00017 **   Filip C. Filippou (filippou@ce.berkeley.edu)                     **
00018 **                                                                    **
00019 ** ****************************************************************** */
00020                                                                         
00021 // $Revision: 1.1.1.1 $
00022 // $Date: 2000/09/15 08:23:16 $
00023 // $Source: /usr/local/cvs/OpenSees/SRC/actor/channel/TCP_Socket.h,v $
00024                                                                         
00025                                                                         
00026 // File: ~/actor/channel/TCP_Socket.h
00027 //
00028 // Written: fmk 
00029 // Created: 11/96
00030 // Revision: A
00031 //
00032 // Purpose: This file contains the class definition for TCP_Socket.
00033 // TCP_Socket is a sub-class of channel. It is implemented with Berkeley
00034 // stream sockets using the TCP protocol. Messages delivery is garaunteed. 
00035 // Communication is full-duplex between a pair of connected sockets.
00036 //
00037 // What: "@(#) TCP_Socket.h, revA"
00038 
00039 #ifndef TCP_Socket_h
00040 #define TCP_Socket_h
00041 
00042 #include <bool.h>
00043 #include <Socket.h>
00044 #include <Channel.h>
00045 #include <SocketAddress.h>
00046 
00047 
00049 class TCP_Socket : public Channel
00050 {
00051   public:
00053     TCP_Socket();        
00055     TCP_Socket(unsigned int);    
00057     TCP_Socket(unsigned int other_Port, char *other_InetAddr); 
00059     ~TCP_Socket();
00060 
00062     char *addToProgram(void);
00063     
00065     virtual int setUpShadow(void);
00067     virtual int setUpActor(void);
00068 
00070     int setNextAddress(const ChannelAddress &otherChannelAddress);
00072     virtual ChannelAddress *getLastSendersAddress(void){ return 0;};
00073 
00075     int sendObj(int commitTag,
00076   MovableObject &theObject, 
00077   ChannelAddress *theAddress =0);
00079     int recvObj(int commitTag,
00080   MovableObject &theObject, 
00081   FEM_ObjectBroker &theBroker,
00082   ChannelAddress *theAddress =0);
00083   
00085     int sendMsg(int dbTag, int commitTag, 
00086   const Message &, 
00087   ChannelAddress *theAddress =0);    
00089     int recvMsg(int dbTag, int commitTag, 
00090   Message &, 
00091   ChannelAddress *theAddress =0);        
00092 
00094     int sendMatrix(int dbTag, int commitTag, 
00095      const Matrix &theMatrix, 
00096      ChannelAddress *theAddress =0);
00098     int recvMatrix(int dbTag, int commitTag, 
00099      Matrix &theMatrix, 
00100      ChannelAddress *theAddress =0);
00101     
00103     int sendVector(int dbTag, int commitTag, 
00104      const Vector &theVector, ChannelAddress *theAddress =0);
00106     int recvVector(int dbTag, int commitTag, 
00107      Vector &theVector, 
00108      ChannelAddress *theAddress =0);
00109     
00111     int sendID(int dbTag, int commitTag, 
00112         const ID &theID, 
00113         ChannelAddress *theAddress =0);
00115     int recvID(int dbTag, int commitTag, 
00116         ID &theID, 
00117         ChannelAddress *theAddress =0);    
00118     
00119   protected:
00121     unsigned int getPortNumber(void) const;
00122     
00123   private:
00125     int sockfd;
00127     struct sockaddr_in  my_Addr, other_Addr;
00129     struct sockaddr myAddr, otherAddr;
00130 #ifdef HOLDEN    
00131 
00132     int addrLength;
00133 #else
00134 
00135     unsigned int addrLength;
00136 #endif
00137 
00138     unsigned int myPort;
00140     char add[40];
00141 };
00142 
00143 
00144 #endif 
00145 
00146 
00147 
00148 
00149 
00150 
00151  
00152 
00153 ÿ
Copyright Contact Us