Wednesday, 11 September 2013

Sending TCP packets through a socket

Sending TCP packets through a socket

I'm using VpnService to capture packets and after capturing them I want to
send them to their destination. Now, the capturing aspect works. I got the
protocol, Source IP / Destination IP and the Source Port / Destination
Port from the packets.
I was thinking about creating a socket with these parameters. VpnService
has actually a method protect() which protects the socket and the traffic
will not be forwarded through VPN.
I don't have muche experience with sockets. But the other day I read a
comment here saying I only send the actual data through the socket and not
the IP or TCP header? But since TCP uses a 3-way-handshake (correct me if
i'm wrong) the first packets wouldn't have any data, just a SYN - flag.
Does that mean this method doesn't work or can i send a packet with the
header through the socket?

No comments:

Post a Comment