Problem with recv on TCP socket

Discussion in 'C Programming' started by Rumburak, Nov 23, 2007.

  1. Rumburak

    Rumburak Guest

    Hello everybody,

    I have a problem receiveing data on a TCP socket. I am sending a
    binary struct over and when receiveing it I found a lot o bytes
    containg 0 inside at the begining. Practically I send 259 bytes, the
    first 255 bytes form a string and the last 4 are an integer. When
    calling recv I get the correct number of bytes (259 in this case), but
    the first about 100 bytes contain only 0 values, the corect string
    content starts at byte 101 (surely enough i don't get the final part
    of the string and neither I get the integer).
    Anyone has a solution for this kind of situation? It seems I get
    some kind of reset or keep-alive and that the first 100 bytes are
    those...

    Thanks a lot,
    Rumburak.
    Rumburak, Nov 23, 2007
    #1
    1. Advertising

  2. In article <>,
    Rumburak <> wrote:

    > I have a problem receiveing data on a TCP socket. I am sending a
    >binary struct over and when receiveing it I found a lot o bytes
    >containg 0 inside at the begining. Practically I send 259 bytes, the
    >first 255 bytes form a string and the last 4 are an integer. When
    >calling recv I get the correct number of bytes (259 in this case), but
    >the first about 100 bytes contain only 0 values, the corect string
    >content starts at byte 101 (surely enough i don't get the final part
    >of the string and neither I get the integer).


    > Anyone has a solution for this kind of situation?



    There is a possibility that your problem is some kind of C array
    issue, but without code we can't really say. Generally speaking,
    TCP and recv() are operating system specific, not part of standard C,
    so if the problem is on the network side then you will need to
    consult an os-specific newsgroup to investigate the networking.
    (MS Windows sockets work a bit differently than Unix sockets for
    example.)
    --
    "All is vanity." -- Ecclesiastes
    Walter Roberson, Nov 23, 2007
    #2
    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. Tiger
    Replies:
    5
    Views:
    966
    Dave Thompson
    May 1, 2006
  2. sonu

    windows socket recv problem

    sonu, Jul 12, 2006, in forum: C Programming
    Replies:
    5
    Views:
    683
    Arkady Frenkel
    Jul 15, 2006
  3. Replies:
    1
    Views:
    306
    Gabriel Genellina
    May 1, 2007
  4. xreload

    Problem with socket.recv()

    xreload, May 17, 2007, in forum: Python
    Replies:
    1
    Views:
    296
    Irmen de Jong
    May 17, 2007
  5. deepak nayak
    Replies:
    3
    Views:
    419
    =?UTF-8?B?RXJpayBXaWtzdHLDtm0=?=
    Oct 25, 2007
Loading...

Share This Page