title: why do Client send a RST packet during TCP handshake?
body: <p>I am puzzled by issue which my client program can't establish TCP connection to remote web server. </p>
  
  <p>[<strong>scene</strong>]</p>
  
  <p>Client program based on ubuntu server 12.04 LTS. </p>
  
  <p>192.168.1.118 (Client program) &lt;-------TCP---------> sync.oncecode.com (web server)</p>
  
  <p>[<strong>phenomenon</strong>]</p>
  
  <p>Client sends SYN, Web Server replies with SYN/ACK and the client immediately sends RST. I can't see anything out of whack in the TCP/IP headers. Could someone give me a clue what might be happening here? I have ran out of ideas ...</p>
  
  <p>[<strong>Tcpdump Log</strong>]</p>
  
  <pre><code>21:31:31.622576 IP 192.168.1.118.51441 &gt; sync.oncecode.com.http: Flags [S], seq 3468888759, win 5360, options [mss 536,sackOK,TS val 40855676 ecr 0,nop,wscale 7], length 0
  
          0x0000:  4500 003c 537d 4000 4006 ee75 c0a8 0176  E..&lt;S}@.@..u...v
          0x0010:  2a79 0c32 c8f1 0050 cec3 0ab7 0000 0000  *y.2...P........
          0x0020:  a002 14f0 f8f7 0000 0204 0218 0402 080a  ................
          0x0030:  026f 687c 0000 0000 0103 0307            .oh|........
  
  21:31:31.690808 IP sync.oncecode.com.http &gt; 192.168.1.118.51441: Flags [S.], seq 1535159088, ack 3468888760, win 5792, options [mss 1440,sackOK,TS val 971694021 ecr 40830368,nop,wscale 6], length 0
  
          0x0000:  4500 003c 0000 4000 3606 4bf3 2a79 0c32  E..&lt;..@.6.K.*y.2
          0x0010:  c0a8 0176 0050 c8f1 5b80 ab30 cec3 0ab8  ...v.P..[..0....
          0x0020:  a012 16a0 6d6e 0000 0204 05a0 0402 080a  ....mn..........
          0x0030:  39ea dfc5 026f 05a0 0103 0306            9....o......
  21:31:31.690826 IP 192.168.1.118.51441 &gt; sync.oncecode.com.http: Flags [R], seq 3468888760, win 0, length 0
  
          0x0000:  4500 0028 0000 4000 4006 4207 c0a8 0176  E..(..@.@.B....v
          0x0010:  2a79 0c32 c8f1 0050 cec3 0ab8 0000 0000  *y.2...P........
          0x0020:  5004 0000 145a 0000  
  </code></pre>
  
  <p>[<strong>append</strong>]
  firewall seems is shutdown, I checked it</p>
  
  <pre><code>olele@ubuntu:~$ sudo iptables -L
  
  Chain INPUT (policy ACCEPT)
  
  target     prot opt source               destination
  
  
  Chain FORWARD (policy ACCEPT)
  
  target     prot opt source               destination
  
  
  Chain OUTPUT (policy ACCEPT)
  
  target     prot opt source               destination
  </code></pre>