00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
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 ÿ