Thread: sendto() returns wrong bytes sent

  1. #1
    Registered User
    Join Date
    Oct 2009
    Posts
    17

    sendto() returns wrong bytes sent

    Hi everybody, the problem is basically what's on the title. sendto() always return 0 but in the other side the complete message is completely received... its a communication between two servers so they are binded to respective ports...

    both are running in the same local machine.

    If anyone as a clue what it might be, please just give me a hint

    thanks in advance
    Last edited by tmcp; 03-08-2011 at 10:07 PM.

  2. #2
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    A variable scope issue?
    Mainframe assembler programmer by trade. C coder when I can.

  3. #3
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    My magic 8-ball ball says ... "you need to post code".
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    My guess is
    result = ( sendto() != numbytes )

    Rather than
    ( result = sendto() ) != numbytes

    In other words, the number of bytes is the result of a boolean expression, and not the actual result from sendto()
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory leaks problem in C -- Help please
    By Amely in forum C Programming
    Replies: 14
    Last Post: 05-21-2008, 11:16 AM
  2. Page File counter and Private Bytes Counter
    By George2 in forum Tech Board
    Replies: 0
    Last Post: 01-31-2008, 03:17 AM
  3. a function that returns the number of bytes of a file
    By paulovitorbal in forum C Programming
    Replies: 22
    Last Post: 05-15-2006, 06:01 PM
  4. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM
  5. Reading Certain number of bytes from a file
    By (TNT) in forum Windows Programming
    Replies: 6
    Last Post: 01-14-2002, 08:35 PM