Working on Process per Protocol application, semi-working but issues with seg faults