XC Open source finite element analysis program
TCP_Socket.h
1 //----------------------------------------------------------------------------
2 // XC program; finite element analysis code
3 // for structural analysis and design.
4 //
5 // Copyright (C) Luis Claudio Pérez Tato
6 //
7 // This program derives from OpenSees <http://opensees.berkeley.edu>
8 // developed by the «Pacific earthquake engineering research center».
9 //
10 // Except for the restrictions that may arise from the copyright
11 // of the original program (see copyright_opensees.txt)
12 // XC is free software: you can redistribute it and/or modify
13 // it under the terms of the GNU General Public License as published by
14 // the Free Software Foundation, either version 3 of the License, or
15 // (at your option) any later version.
16 //
17 // This software is distributed in the hope that it will be useful, but
18 // WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 //
23 // You should have received a copy of the GNU General Public License
24 // along with this program.
25 // If not, see <http://www.gnu.org/licenses/>.
26 //----------------------------------------------------------------------------
27 /* ****************************************************************** **
28 ** OpenSees - Open System for Earthquake Engineering Simulation **
29 ** Pacific Earthquake Engineering Research Center **
30 ** **
31 ** **
32 ** (C) Copyright 1999, The Regents of the University of California **
33 ** All Rights Reserved. **
34 ** **
35 ** Commercial use of this program without express permission of the **
36 ** University of California, Berkeley, is strictly prohibited. See **
37 ** file 'COPYRIGHT' in main directory for information on usage and **
38 ** redistribution, and for a DISCLAIMER OF ALL WARRANTIES. **
39 ** **
40 ** Developed by: **
41 ** Frank McKenna (fmckenna@ce.berkeley.edu) **
42 ** Gregory L. Fenves (fenves@ce.berkeley.edu) **
43 ** Filip C. Filippou (filippou@ce.berkeley.edu) **
44 ** **
45 ** ****************************************************************** */
46 
47 // $Revision: 1.4 $
48 // $Date: 2005/11/23 23:43:47 $
49 // $Source: /usr/local/cvs/OpenSees/SRC/actor/channel/TCP_Socket.h,v $
50 
51 
52 // Written: fmk
53 // Created: 11/96
54 // Revision: A
55 //
56 // What: "@(#) TCP_Socket.h, revA"
57 
58 #ifndef TCP_Socket_h
59 #define TCP_Socket_h
60 
61 #include "utility/actor/channel/Socket.h"
62 #include "utility/actor/channel/Channel.h"
63 #include "../address/SocketAddress.h"
64 
65 namespace XC {
67 //
71 class TCP_Socket : public Channel
72  {
73  private:
74  socket_type sockfd;
75 
76  union {
77  struct sockaddr addr;
78  struct sockaddr_in addr_in;
79  } my_Addr;
80  union {
81  struct sockaddr addr;
82  struct sockaddr_in addr_in;
83  } other_Addr;
84 
85  socklen_type addrLength;
86 
87  unsigned int myPort;
88  int connectType;
89 
90  char add[40];
91  protected:
92  unsigned int getPortNumber(void) const;
93  public:
94  TCP_Socket();
95  TCP_Socket(unsigned int);
96  TCP_Socket(unsigned int other_Port, char *other_InetAddr);
97  ~TCP_Socket();
98 
99  char *addToProgram(void);
100 
101  virtual int setUpConnection(void);
102 
103  int setNextAddress(const ChannelAddress &otherChannelAddress);
104  virtual ChannelAddress *getLastSendersAddress(void){ return 0;};
105 
106  int sendObj(int commitTag, MovableObject &, ChannelAddress *theAddress =0);
107  int recvObj(int commitTag, MovableObject &, FEM_ObjectBroker &, ChannelAddress *theAddress =0);
108 
109  int sendMsg(int dbTag, int commitTag, const Message &, ChannelAddress *theAddress =0);
110  int recvMsg(int dbTag, int commitTag, Message &, ChannelAddress *theAddress =0);
111 
112  int sendMatrix(int dbTag, int commitTag, const Matrix &, ChannelAddress *theAddress =0);
113  int recvMatrix(int dbTag, int commitTag, Matrix &, ChannelAddress *theAddress =0);
114 
115  int sendVector(int dbTag, int commitTag, const Vector &, ChannelAddress *theAddress =0);
116  int recvVector(int dbTag, int commitTag, Vector &, ChannelAddress *theAddress =0);
117 
118  int sendID(int dbTag, int commitTag, const ID &, ChannelAddress *theAddress =0);
119  int recvID(int dbTag, int commitTag, ID &, ChannelAddress *theAddress =0);
120  };
121 } // end of XC namespace
122 
123 
124 #endif
125 
126 
127 
128 
129 
130 
131 
132 
Definition: Vector.h:82
FEM_ObjectBroker is is an object broker class for the finite element method. All methods are virtual ...
Definition: FEM_ObjectBroker.h:138
TCP_Socket is a sub-class of channel. It is implemented with Berkeley stream sockets using the TCP pr...
Definition: TCP_Socket.h:71
Definition: ChannelAddress.h:69
Object that can move between processes.
Definition: MovableObject.h:91
Definition: ID.h:77
Definition: Matrix.h:82
Channel is an abstract base class which defines the channel interface. A channel is a point of commun...
Definition: Channel.h:85
Message between processes.
Definition: Message.h:67
================================================================================
Definition: ContinuaReprComponent.h:34