| 320 | |
| 321 | |
| 322 | int |
| 323 | TCP_Socket::sendObj(int commitTag, |
| 324 | MovableObject &theObject, ChannelAddress *theAddress) |
| 325 | { |
| 326 | // first check address is the only address a TCP_socket can send to |
| 327 | SocketAddress *theSocketAddress = 0; |
| 328 | if (theAddress != 0) { |
| 329 | if (theAddress->getType() == SOCKET_TYPE) |
| 330 | theSocketAddress = (SocketAddress *)theAddress; |
| 331 | else { |
| 332 | opserr << "TCP_Socket::sendObj() - a TCP_Socket "; |
| 333 | opserr << "can only communicate with a TCP_Socket"; |
| 334 | opserr << " address given is not of type SocketAddress\n"; |
| 335 | return -1; |
| 336 | } |
| 337 | |
| 338 | if (memcmp((char *) &other_Addr.addr_in, (char *) &theSocketAddress->address.addr, |
| 339 | theSocketAddress->addrLength) != 0) { |
| 340 | |
| 341 | opserr << "TCP_Socket::sendObj() - a TCP_Socket "; |
| 342 | opserr << "can only communicate with one other TCP_Socket"; |
| 343 | opserr << " address given is not that address\n"; |
| 344 | return -1; |
| 345 | } |
| 346 | } |
| 347 | |
| 348 | return theObject.sendSelf(commitTag, *this); |
| 349 | } |
| 350 | |
| 351 | |
| 352 | int |