library/src/blockclass/BP-BlockClass.cc
// connects to a host on port using protocol specified
connects to a host on port using protocol specified
connects to a host on port using protocol specified
int Block::SockConnect(char * destAddr, short destPort, int proto)
{
	if(!destAddr)
		return ERR_FAILURE;
	if(!destPort)
		return ERR_FAILURE;
	if (this->net_handle)
	{
		this->SockClose();
		this->SockDestroy();
		this->net_handle = NULL;
	}
	this->net_handle = BP_NetCreateSocket(destAddr, destPort, proto, 0, NULL);
	if (!this->net_handle)
	{
		return ERR_FAILURE;
	}
	return ERR_SUCCESS;
}
int Block :: SockConnect ( char * destAddr , short destPort , int proto ) { if ( ! destAddr ) return ERR_FAILURE ; if ( ! destPort ) return ERR_FAILURE ; if ( this -> net_handle ) { this -> SockClose ( ) ; this -> SockDestroy ( ) ; this -> net_handle = NULL ; } this -> net_handle = BP_NetCreateSocket ( destAddr , destPort , proto , 0 , NULL ) ; if ( ! this -> net_handle ) { return ERR_FAILURE ; } return ERR_SUCCESS ; }
connects to a host on port using protocol specified
connects to a host on port using protocol specified
// ensure we have parameter values // First see if we have an existing net handle, if we do, close and // destroy resultant data. // close the socket // destroy the socket // set pointer to NULL // create a new network socket // ensure it was created OK // return indicating success