thats not software related. You are just talking about switching mediums. Your router or switch should handle all of the decapsulation and encapsulation.....The IP headers with the well known port (socket, whatever) should remain untouched.
___________________________________
[morse]--... ...--[/morse], Eric.