Computing.Net > Forums > Programming > buffer problem in c++ sockets

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

buffer problem in c++ sockets

Reply to Message Icon

Name: Wadhera G
Date: April 22, 2003 at 22:33:46 Pacific
OS: Linux RHL 8.0
CPU/Ram: P III 450 , 128 MB
Comment:

Hi,

I am implementing an information sharing system with messaging as the method.
I have a number of client/servers on the same machine.

for the client my sequence is
socket()
bind() /* not necessary though */
connect()
send()
recv() /* repsonse */

the server is
socket()
listen()
while(true)
{
accept()
recv()
send() /* response */
}

data from one response buffer is coming in the other response buffers even after making sure that before every client-server interaction i free the buffers and reallocate them.

also , the buffer size is 16384

kindly suggest a solution.

Gauhar



Sponsored Link
Ads by Google

Response Number 1
Name: Don Arnett
Date: April 23, 2003 at 08:28:03 Pacific
Reply:

Need more input...

Please show how you are declaring the buffers and the parameters that you pass to recv()



0

Response Number 2
Name: Wadhera G
Date: April 23, 2003 at 22:30:55 Pacific
Reply:

Hi,

thanx for the response

the problem still remains that buffers from one client server pair still overlap with others.

Anywayz I have worked around the problem by taking the number of bytes recv'd and copy those many bytes to a string and forget about the rest which still contains data from other client server pairs.

Thanx again,

Gauhar


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: buffer problem in c++ sockets

Buffer Overflow in C www.computing.net/answers/programming/buffer-overflow-in-c/9279.html

problem in c www.computing.net/answers/programming/problem-in-c/12469.html

CScokets problem in C++ www.computing.net/answers/programming/cscokets-problem-in-c/13674.html