PDA

View Full Version : Additional data getting send on QTCPSocket when SOCKS5 proxy is used



darshan.hardas
20th October 2012, 10:07
The implementation is to send the file to the server using QTcpSockets. I have read the files in buffer and sending it through the active TCP connection. The data is transmitted and the file is sent to the server successfully.

Now, when the data is sent via SOCKS5 proxy, the data is transmitted more than the actual file size corrupting the file on the remote server machine.

To ensure that the data is written on the socket, I have used the QTcpSocket::bytesWritten signal which sends the next chunk of data onto the socket. The proxy is set using QTcpSocket::setProxy.

I have verified that the data read is same as the file size.


Please let me know your valuable comments. Thanks in advance.

wysota
20th October 2012, 13:48
Now, when the data is sent via SOCKS5 proxy, the data is transmitted more than the actual file size corrupting the file on the remote server machine.
Hmm??? Where does the extra data come from?

ChrisW67
21st October 2012, 04:43
I will check but I am fairly sure I am not missing any bytes here. ;)

Darshan: TCP Sockets work like pipes: bytes in one end, the same bytes out the other in the same order. There is no magic. If x+4 bytes are coming out then x+4 bytes are going in. Using QDataStream by any chance?

darshan.hardas
21st October 2012, 08:39
We are just using a TCPSockets and not the datastream. The data goes well if the proxy is not involved. But as we set the proxy to the data channel QTcpSocket , additional data is trasmitted.

wysota
21st October 2012, 09:00
additional data is trasmitted.
What additional data?

Try transmitting "this is a test text" text and see what you get on the other end. I'm pretty certain it will be "this is a test text".

ChrisW67
21st October 2012, 09:42
There is no way for us to know on presented information where your alleged extra data is coming from.

darshan.hardas
23rd October 2012, 06:23
Thanks for all your inputs.. I have to look into the buffer which are used to send the data..