Creating a tcp connection using raw sockets is somewhere between difficult and impossible; you will need to implement the entire tcp protocol in your program, and also prevent the kernel from sending its own responses to packets (if the kernel has an IP address at this address on this interface).
This is probably not what you want. However, if you want to, it is trivial to send tcp frames with any source port you want, since you can specify it in the tcp header, which, of course, if you implement your own TCP layer, you will need to understand.
Markr source share