I doing this server and client program. The sever has to output to the client.

strcpy ( outBuf, " " );
						sprintf ( outBuf, "cylinder: %d Sector: %d\n", cylinders, sectors );
						if ( write ( client_sockfd, outBuf, strlen ( outBuf ) + 1 ) < 0 ) {

							perror ( "Client: Fails to write to socket." );

							exit ( 3 );

						}

I cout outBuf to server:

outBuf: cylinder: 5 Sector: 5

at the client end:
> I -- this is input
cylinder: 5 Sector: --this is all that gets printed.
> enter I again and hit enter
5
>

as you can see when i hit return, then the rest of the stream gets printed. can someone help me fix this]?

thanks

drjay
the when i hit enter again, the 5 gets printed.

I don't get your question ...

when the sever out put to the client, how do i get the whole stream rather than just part of it?

its server not sever... that was a typo.

char outBuf[128];
int cylinders, sectors, client_sockfd;
sprintf ( outBuf, "cylinder: %d Sector: %d\n", cylinders, sectors );
write ( client_sockfd, outBuf, strlen ( outBuf ) + 1 )

This doesn't write the entire outBuf to the client's screen.

How question is how do I to fix it? anyone???

Can you please provide me with some more information about what your program actually does ?

I actually fixed it. The fault was at the client end. worked on it for about 5 hours!

The read function in the client read in a char array of a fixed size. when the write from the server is bigger than that, it didnt display the whole thing.

I thought it was something wrong with at the server end and tried a million things. eventually i gave up and move on to implementing other requirements and while fixing something else i found out that bug!

thanks you all your responses...

drjay

commented: I want to congratulate you because you could fix your own code :) +2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.