| 347 | |
| 348 | |
| 349 | int |
| 350 | UDP_Socket::recvObj(int commitTag, |
| 351 | MovableObject &theObject, FEM_ObjectBroker &theBroker, |
| 352 | ChannelAddress *theAddress) |
| 353 | { |
| 354 | int res = theObject.recvSelf(commitTag, *this, theBroker); |
| 355 | if (res < 0) |
| 356 | return res; |
| 357 | |
| 358 | // check the address that message came from was correct |
| 359 | if (theAddress != 0) { |
| 360 | SocketAddress *theSocketAddress = 0; |
| 361 | |
| 362 | if (theAddress->getType() == SOCKET_TYPE) { |
| 363 | theSocketAddress = (SocketAddress *)theAddress; |
| 364 | |
| 365 | if (memcmp((char *) &theSocketAddress->address.addr, (char *) &other_Addr.addr, |
| 366 | theSocketAddress->addrLength) != 0) { |
| 367 | opserr << "UDP_Socket::recvObj() - a UDP_Socket "; |
| 368 | opserr << "can only look at first incoming message\n"; |
| 369 | opserr << "The last message did not come from write scource\n"; |
| 370 | return -1; |
| 371 | } |
| 372 | } |
| 373 | else { |
| 374 | opserr << "UDP_Socket::recvObj() - a UDP_Socket "; |
| 375 | opserr << "can only communicate with a UDP_Socket"; |
| 376 | opserr << " address given is not of type SocketAddress\n"; |
| 377 | return -1; |
| 378 | } |
| 379 | } |
| 380 | |
| 381 | return 0; |
| 382 | } |
| 383 | |
| 384 | |
| 385 | int |
no test coverage detected