Problem with recv on TCP socket

R

Rumburak

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.
 
W

Walter Roberson

Rumburak said:
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.)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top