Archived Forum Post

Index of archived forum posts

Question:

TCP Socket receiving data it just sent

Nov 20 '14 at 17:48

Does any have an idea why the TCP Socket would return the exact data it just sent?

All steps in Blocking mode ...

Send_Bytes(...);

Receive_Bytes(....);

Received exactly what was sent.

This is not correct TCP socket behavior.

Any comments appreciated.

Joe


Answer

I don't see how that's possible. The Socket API is widely used, and if this were the case Chilkat would be receiving hundreds of problem reports from existing customers.

The only way I'd seriously consider this a potential problem within the component, is if you could provide an example that demonstrates the behavior. For example, can you connect to port 80 of some web server, send something, and then read back exactly what you sent?

My guess is that you either have a bug in your app code, or the server is actually echoing back exactly what you sent to it..


Answer

I could no see how it was possible either --- just wanted to have someone tell me I was wrong or that a loop-back was in-play.

I spent 3 hours looking at my code --- could not find the issue.

Posted here --- you tell me I'm wrong --- I go back and look again.

Found it --- I really feel stupid.

I had my application working with my own written Socket interface. When I needed FTP -- I decided to stop putting my time into communication code and put the time into application code --- so I purchased this great product.

I thought I had successfully converted my code to ChilKat code --- all but one place.

I had previously used the same buffer to create the xmit message and then receive the message.

THAT was the issue -- I failed to change my pointer from my xmit buffer to the buffer I compiled from the ChilKat received data.

Sometimes you need someone to tell you you are wrong to see the trees.

Thanks.

Joe


Answer

Thanks Joe! It's no problem at all. :)