![]() |
| | #1 |
| Registered User Join Date: May 2005
Posts: 17
| Client application having problem receiving from server side? I have created a client server application using Winsock2. Now the problem is that data send by server is not fully received by client in one go. It is received in installments & also not correctly received. For example, the server application sends 293 bytes of data in a buffer of size 5000. Now the client receives the data in two installments: Ist--> 625 bytes & IInd--> 4375 bytes. Logically the first installment of 625 bytes must contain all the 293 bytes of data & second installment of 4375 bytes must be all 0's. But the problem is that the first installment contains all 0's & second installment contains 293 bytes of data. Why is this happening. Also how can i make sure that all the data send by server is received by the client in one go. Waiting for suggestions Regards |
| dp_76 is offline | |
| | #2 |
| Registered User Join Date: Nov 2002
Posts: 491
| If the data is not coming over the wire correctly then you are not sending it correctly. Also you have a flaw in your thinking. You need to view the socket as a stream, not as the entire block of data. You handle it as it comes in, if that involves buffering it then so be it. But the data on the stream is going to be broken down into smaller portions and you'll only be able to receive what is there when you ask for it. |
| orbitz is offline | |
| | #3 |
| Magically delicious Join Date: Oct 2001
Posts: 856
| It would be useful to provide the source surrounding the server's send() and the client's recv(), but I will expand on what orbitz replied. You've stated that the server sends a buffer of 5000 bytes to the client and that the client is receiving the data in two "installments." If you know the server is sending 5000, your client should be receiving 5000. This is not required, but it's something to think about. Furthermore, you should understand that the client receives streams of bytes in the order they were sent, one byte at a time. Start from there, supply some source, and update us with your progress/discoveries. |
| LuckY is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| IPv6 multicast client fails to receive server response | perfect | Networking/Device Communication | 10 | 06-21-2009 11:30 PM |
| How to Send Mac Address From Client to Server | Lieyza197 | C Programming | 2 | 05-27-2009 09:58 AM |
| Multi-threaded UDP Server Problem | nkhambal | C Programming | 0 | 07-05-2005 02:27 PM |
| Run time error at client side query? | dp_76 | Networking/Device Communication | 0 | 07-01-2005 03:02 AM |
| [SOCKETS] Solaris server in C, NT client in VB | Daveg27 | C Programming | 3 | 05-23-2002 10:02 AM |