I need to attach a linetrace to the muzzle socket component of a gun skeletal mesh. Is it possible?

Would I have to write code inside of the gun actor itself?
I have used the First Person Camera Component but now I have a gun skeletal mesh with a muzzle socket how would I attach the line trace to the muzzle of the the skeletal mesh? Should I attach a line trace to the muzzle. Is there another more effective option. Am I close or far?

void UE4Character::Linetrace()
{
		FHitResult* HitResult = new FHitResult();
		FHitResult Hit;
		const float BulletDistance = 20000.0f;
		FVector CameraForward = FVector(FP_Gun->GetForwardVector());
		const FVector StartTrace = FP_Gun->GetSocketLocation("Muzzle");
		const FVector EndTrace = (FP_Gun->GetForwardVector() * BulletDistance);
		FCollisionQueryParams QueryParams = FCollisionQueryParams(SCENE_QUERY_STAT(WeaponTrace), 
                 false, this);
		FCollisionQueryParams* TraceParams = new FCollisionQueryParams();
}

Download ShooterGameExample and use that code!(both projectile and linetrace and already networked!)

const FVector StartTrace = FP_Gun->GetSocketLocation(“Muzzle”); This code is correct I just needed to attach the gun itself to the character. Note to self: Whenever attaching a muzzle to anything to the character itself always have the skeletal mesh visible and attached to the character.

Could you provide a link to the example if possible?