You can do it . Normally the whole packet will store as a structure .So when you receive a socket you can just change the particular structure member ( part of the packet ) then you can forward it .