How can I make a tcp connect by using raw socket?
Because the tcp work in the three handshake way,that to make a
tcp connect by using raw socket is something difficult.
I send the SYN packet and receive the ACK|SYN
packet ,but when I want to send the ACK packet to finish the three handshake ,the system has send the RST packet automatically.So my three handshake has been cancel .
How can I make a tcp connect by using raw socket?
thank.
[421 byte] By [
Endicking] at [2007-11-18 20:34:00]

# 1 Re: How can I make a tcp connect by using raw socket?
To make the matter simple you cannot. If you really want to, you have to rewrite the stack, which is equivalent to creating your own protocol. TCP connection is established between stacks not programs. Now what happened to you is as follows.
Your program sends a SYN packet to the peer stack. Now remember, this packet that you send looks like a TCP SYN packet from outside, but actually it is not cause it is not sent by any TCP stack. Meanwhile the peer gets the SYN packet and thinks "Hmm..someone wants to connect and I have a service running at that port." So it sends a SYN/ACK packet back. Now this packet is recvd by your stack and not by your program. So your stack says "Hey, what the h e l l is this? I didn't ask for any connection." and send a RST packet to clear any misunderstanding.
Hope it is clear.
In general raw sockets are used for using protocols like ICMP or maybe UDP or to create some other protocols (apart from malicious purpose).
# 3 Re: How can I make a tcp connect by using raw socket?
Originally posted by En****ing
Any other method? What do you mean?