Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>return value for the send that succeeds = 35 return value for the send that FAILS = 32</p> <p>Documentation says that successful send should return None.</p> </blockquote> <p>No it doesn't. <a href="http://docs.python.org/library/socket.html#socket.socket.send" rel="nofollow">Documentation</a> says:</p> <blockquote> <p><strong>Returns the number of bytes sent.</strong> Applications are responsible for checking that all data has been sent; if only some of the data was transmitted, the application needs to attempt delivery of the remaining data. For further information on this concept, consult the Socket Programming HOWTO.</p> </blockquote> <p>You still haven't explained what you mean by "FAILS". The <code>send</code> call is returning successfully, and it's almost certainly placed 32 bytes into the socket write buffer.</p> <p>If the only reason you think it's failing is that it returns the correct value, then the answer is obviously that it's not failing.</p> <p>If something else is going wrong, there are all kinds of things that could be wrong at a higher level. One likely one is this: The server (especially if it was coded by someone who doesn't understand sockets well) is coded to expect one <code>recv()</code> of 35 bytes, and one <code>recv()</code> of 32 bytes. But it's actually getting a single <code>recv()</code> of 67 bytes, and waiting forever for the second, which never comes. There is no rule guaranteeing that each <code>send()</code> on a stream (TCP) socket corresponds to one <code>recv()</code> on the other side. You need to create some kind of stream protocol that demarcates the separate messages.</p> <p>Meanwhile, the quote you're referring to is irrelevant. It's describing how client sockets are used by simple web browsers: They make a connection, do one send, receive all the data, then destroy the connection. I can see why it misled you, and you may want to file a documentation bug to get it improved. But for now, just ignore it.</p> <p>If you want to make absolutely sure that the client is sending the right data, and the problem is in the server, there are two easy ways to do that:</p> <ol> <li><p>Use <a href="http://en.wikipedia.org/wiki/Netcat" rel="nofollow">netcat</a> as a trivial substitute server (e.g., <code>nc -kl 6000</code>, replacing the "6000" with the actual port) and making sure it logs what you think the server should be seeing.</p></li> <li><p>Use <a href="http://www.wireshark.org/" rel="nofollow">Wireshark</a> to watch the connection between the client and server.</p></li> </ol> <p>Once you've verified that the problem is on the server side, you need to debug the server. If you need help with that, that's probably best done in a new question, where you can post the server code instead of the client, and explain (with a link here) that you're sure the client is sending the right information.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload