source/TCP.cpp
xiTCPListen * xiTCPListen::CreateOnPort( const uint16_t port, const uint8_t protocol ) {
	xiTCPListen * const self = new xiTCPListen( protocol );

	if ( self->status == STATUS_INVALID ) {
		delete( self );

		return nullptr;
	}

	if ( protocol == PROTO_V4 ) {
		if ( !self->BindToPortV4( port ) ) {
			delete( self );

			return nullptr;
		}
	} else if ( protocol == PROTO_V6 ) {
		if ( !self->BindToPortV6( port ) ) {
			delete( self );

			return nullptr;
		}
	} else {
		delete( self );

		return nullptr;
	}

	self->Grab();

	return self;
}
/*
====================
xiTCPListen::CreateOnPort

	Allocates memory and constructs a TCP listen server socket
	If it fails, the memory is cleaned up and a nullptr returned
====================
*/
:CreateOnPort
Allocates memory and constructs a TCP listen server socket
If it fails, the memory is cleaned up and a nullptr returned
: CreateOnPort Allocates memory and constructs a TCP listen server socket If it fails the memory is cleaned up and a nullptr returned
xiTCPListen * xiTCPListen::CreateOnPort( const uint16_t port, const uint8_t protocol ) {
	xiTCPListen * const self = new xiTCPListen( protocol );
	if ( self->status == STATUS_INVALID ) {
		delete( self );
		return nullptr;
	}
	if ( protocol == PROTO_V4 ) {
		if ( !self->BindToPortV4( port ) ) {
			delete( self );
			return nullptr;
		}
	} else if ( protocol == PROTO_V6 ) {
		if ( !self->BindToPortV6( port ) ) {
			delete( self );
			return nullptr;
		}
	} else {
		delete( self );
		return nullptr;
	}
	self->Grab();
	return self;
}
xiTCPListen * xiTCPListen :: CreateOnPort ( const uint16_t port , const uint8_t protocol ) { xiTCPListen * const self = new xiTCPListen ( protocol ) ; if ( self -> status == STATUS_INVALID ) { delete ( self ) ; return nullptr ; } if ( protocol == PROTO_V4 ) { if ( ! self -> BindToPortV4 ( port ) ) { delete ( self ) ; return nullptr ; } } else if ( protocol == PROTO_V6 ) { if ( ! self -> BindToPortV6 ( port ) ) { delete ( self ) ; return nullptr ; } } else { delete ( self ) ; return nullptr ; } self -> Grab ( ) ; return self ; }
xiTCPListen::CreateOnPort
Allocates memory and constructs a TCP listen server socket
If it fails, the memory is cleaned up and a nullptr returned
xiTCPListen :: CreateOnPort Allocates memory and constructs a TCP listen server socket If it fails the memory is cleaned up and a nullptr returned