Пример #1
0
int
MPI_Channel::setNextAddress(const ChannelAddress &theAddress)
{	
    MPI_ChannelAddress *theMPI_ChannelAddress = 0;
    if (theAddress.getType() == MPI_TYPE) {
      theMPI_ChannelAddress = (MPI_ChannelAddress *)(&theAddress);    
      otherTag = theMPI_ChannelAddress->otherTag;
      otherComm= theMPI_ChannelAddress->otherComm;
    }
    else {
	opserr << "MPI_Channel::setNextAddress() - an MPI_Channel ";
	opserr << "can only communicate with an MPI_Channel";
	opserr << " address given is not of type MPI_ChannelAddress\n"; 
	return -1;	    
    }		    	
	
    return 0;
}
Пример #2
0
int
UDP_Socket::setNextAddress(const ChannelAddress &theAddress)
{	
    SocketAddress *theSocketAddress = 0;
    if (theAddress.getType() == SOCKET_TYPE) {
        theSocketAddress = (SocketAddress *)(&theAddress);    
        // set up the address of the Socket to which data will be sent
        bcopy((char *) &theSocketAddress->address.addr, (char *) &other_Addr, 
            theSocketAddress->addrLength);
        addrLength = theSocketAddress->addrLength;	

        return  0;	    
    }
    else {
        opserr << "UDP_Socket::setNextAddress() - a UDP_Socket ";
        opserr << "can only communicate with a UDP_Socket";
        opserr << " address given is not of type SocketAddress\n"; 
        return -1;	    
    }		    	
}
Пример #3
0
int
TCP_Socket::setNextAddress(const ChannelAddress &theAddress)
{	
    SocketAddress *theSocketAddress = 0;
    if (theAddress.getType() == SOCKET_TYPE) {
        theSocketAddress = (SocketAddress *)(&theAddress);    
        // check address is the only address a TCP_socket can send to
        if (bcmp((char *) &other_Addr.addr_in, (char *) &theSocketAddress->address.addr, 
            theSocketAddress->addrLength) != 0) {

                opserr << "TCP_Socket::setNextAddress() - a TCP_Socket ";
                opserr << "can only communicate with one other TCP_Socket\n"; 
                return -1;
        }
    }
    else {
        opserr << "TCP_Socket::setNextAddress() - a TCP_Socket ";
        opserr << "can only communicate with a TCP_Socket";
        opserr << " address given is not of type SocketAddress\n"; 
        return -1;	    
    }		    	

    return 0;
}