0

I started working recently in IT field and as first assignment they want me to communicate with a remote board with a simple Socket using Java. Today I completed all the job but I noticed that my messages wasn't correctly received... So I started digging and start using wireshark for a better understanding of "What is going on?". I know that before sending data the client and server do the 3-way handshake, then the client send its data and when its done it close the connection and say by to the server. Now thats my question: Im sending a packet to the remote board using Packet Sender (perfect for debug and test) and that's what I see:

 First 3 message are the handshake
 1. client SYN server
 2. server SYN, ACK client
 3. client ACK server
then I got this messages
 4. client PSH, ACK server
 5. server ACK client
 6. client FIN, ACK server
 7. server ACK client
 8. server FIN, ACK client
 9. client ACK server

The PSH is the phase where I sent the byte to the server socket, then the server reply so I close (FIN) the connection and then the server does the same. These order is super important to be respected in order to have a right communication? This is the result of my packet sent using my program in JAVA:

Handshake
 1. client SYN server
 2. server SYN, ACK client
 3. client ACK server
then I got this messages
 4. client PSH, ACK server
 5. client FIN, ACK server
 6. server ACK client
 7. server ACK client
 8. server FIN, ACK client
 9. client ACK server

What do you think? How can I fix this problem? It's really annoying because the server didnt do nothing at all. Should I try to let the socket opened for a few milliseconds? Does the TCP protocol work always like described above in the Packet Sender example or can be mixed with more request as happen in my program? Thank you all

1

I solved the problem putting a delay of 300ms before closing Streand and the Socket so the Client and Server has the right time to talk each other. Lower delay make them unsynch again! May this post help someone :D

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.