Skip to content
Advertisement

Python socket not delivering packet

I am creating a simple messaging server and client in Python using the socket library. First I am doing some validation and a key exchange before I let the user send messages. Every once and a while I get an issue where the server will send a message and the client won’t receive it and then the server will move on trying to receive a message, but the client is still blocking on the receive call too so they are in a deadlock. I am confused how this is happening because I thought the socket API ran TCP which should be guaranteed delivery.

This is part of the server side:

JavaScript

This is part of the client side:

JavaScript

Most of the time this works flawlessly. However sometimes when the client side is trying to receive A the server sends it then moves on to receiving B, but the client never receives A and doesn’t move on.

Thank you for any help. Also I know this really isn’t the best way to do Diffie Hellman and that the numbers are not large enough.

Advertisement

Answer

As @user207421 said in his comment I was already reading them because it was getting more than one message.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement