473,385 Members | 1,597 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Problem with recv on TCP socket

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.
Nov 23 '07 #1
1 2233
In article <f7**********************************@e1g2000hsh.g ooglegroups.com>,
Rumburak <bo*********@gmail.comwrote:
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
Nov 23 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: flupke | last post by:
Hi, I have a gui (made in wxPython) that enables a user to connect to a server and issue some commands. The problem occurs when i try to disconnect the client. It exits but it doesn't return to...
0
by: Tony Caduto | last post by:
Hi, I am developing a socket server in C# and I want it to be blocking. Anyway I have it working with threads, as each client connects the socket spawned from the accept method is sent to a client...
11
by: zaebos | last post by:
hi, i have this code which is part of a main program, to email from within the program a log file: int MailIt (char *mailserver, char *emailto, char *emailfrom, char *emailsubject, char...
6
by: s_4 | last post by:
Hello! Sorry about my english - I write to you from poland. I have strange problem. Bind() return '16'. Documentation say that it should return 0 (no error) or -1 (some error). Here is the code...
5
by: nick048 | last post by:
Hi to All, Foollowing Your suggestion, I have written this code: #include <stdio.h> #include <string.h> #include <malloc.h> #define BUFLEN 100
0
by: george585 | last post by:
Hello! I am new to network programming, and understand just basics. Using some sample code, and having read documentation, I managed to create a simple app in C# and VB.NET. The application is...
10
by: Hendrik van Rooyen | last post by:
While doing a netstring implementation I noticed that if you build a record up using socket's recv(1), then when you close the remote end down, the recv(1) hangs, despite having a short time out...
2
by: manontheedge | last post by:
I've got two separate programs, one being the "server" and the other one (this one) being the "client". I've got the "server" to where it just sits and waits for connections, and sends out whatever...
1
by: Jean-Paul Calderone | last post by:
On Mon, 12 May 2008 08:34:07 -0700 (PDT), petr.poupa@gmail.com wrote: You cannot reconnect a socket. You need to create a new one for each connection. It's also almost certainly the case that...
3
by: Hukkky | last post by:
I'm testing simple server/client codes on linux. just server can wait for client's connect sign and accept, and client can't connect to server, this is all. There's no problems just for this...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.