Problem Sending Data with SocketServer.ThreadingTCPServer

Discussion in 'Python' started by UrgeOverkill, Feb 19, 2004.

  1. UrgeOverkill

    UrgeOverkill Guest

    I'm having a problem sending data from a socket server. The server
    side reports that it has sent 4845 bytes but the client reports only
    1448 bytes received. The kicker is that this ONLY happens accross the
    internet... I've tested this with multiple connections. If I run the
    same server and client, connect them locally I don't have a problem
    with byte totals. Is there a timeout that I need to set... I've
    looked at and change several SOL_SOCKET parameters (i.e. SO_SNDBUF,
    etc) but this hasn't fixed my problem... This is the last thing I need
    to fix on this and any help would be greatly appreciated...
    UrgeOverkill, Feb 19, 2004
    #1
    1. Advertising

  2. UrgeOverkill

    Dave Brueck Guest

    Urge wrote:
    > I'm having a problem sending data from a socket server. The server
    > side reports that it has sent 4845 bytes but the client reports only
    > 1448 bytes received. The kicker is that this ONLY happens accross the
    > internet... I've tested this with multiple connections. If I run the
    > same server and client, connect them locally I don't have a problem
    > with byte totals. Is there a timeout that I need to set... I've
    > looked at and change several SOL_SOCKET parameters (i.e. SO_SNDBUF,
    > etc) but this hasn't fixed my problem... This is the last thing I need
    > to fix on this and any help would be greatly appreciated...


    How about posting some code if you can... Are you sure that the client has
    received all the data that is available? It may take several recv (or read)
    calls - just because your first receive obtained 1448 bytes doesn't mean that
    there's nothing more on the way.

    -Dave
    Dave Brueck, Feb 19, 2004
    #2
    1. Advertising

  3. UrgeOverkill

    Peter Hansen Guest

    UrgeOverkill wrote:
    >
    > I'm having a problem sending data from a socket server. The server
    > side reports that it has sent 4845 bytes but the client reports only
    > 1448 bytes received. The kicker is that this ONLY happens accross the
    > internet... I've tested this with multiple connections. If I run the
    > same server and client, connect them locally I don't have a problem
    > with byte totals. Is there a timeout that I need to set... I've
    > looked at and change several SOL_SOCKET parameters (i.e. SO_SNDBUF,
    > etc) but this hasn't fixed my problem... This is the last thing I need
    > to fix on this and any help would be greatly appreciated...


    Example code?

    You don't give quite enough info for one to how familiar you are with
    socket programming. Are you aware, for example, that you have to read
    repeatedly from the socket, not just call .recv() once? (That's a common
    rookie mistake.)

    What code is generating these reports about bytes sent and received?
    Why do you trust the numbers? Just because a high level call with 4845
    bytes went down into the .send routine and returned doesn't mean that
    many bytes actually went out the port.

    Have you reduced this down to the smallest program you can make which
    demonstrates the problem? Often the problem will go away at some
    point as you do that, and then you can quickly home in on the change
    which was involved.

    -Peter
    Peter Hansen, Feb 19, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stuart D. Gathman

    Debugging SocketServer.ThreadingTCPServer

    Stuart D. Gathman, Jan 16, 2007, in forum: Python
    Replies:
    0
    Views:
    330
    Stuart D. Gathman
    Jan 16, 2007
  2. Jean-Paul Calderone

    Re: Debugging SocketServer.ThreadingTCPServer

    Jean-Paul Calderone, Jan 16, 2007, in forum: Python
    Replies:
    2
    Views:
    390
    R. Bernstein
    Feb 4, 2007
  3. Brad Brock
    Replies:
    0
    Views:
    340
    Brad Brock
    May 19, 2007
  4. Okko Willeboordse
    Replies:
    0
    Views:
    427
    Okko Willeboordse
    Nov 9, 2008
  5. MrSmile
    Replies:
    3
    Views:
    169
    Tamer Higazi
    Nov 1, 2011
Loading...

Share This Page