Morning Fellas,
Need some pointers from you folks. Am stuck with a simple issue.
On the server i have a struct defined as:
struct sendbuff { int count; char toprint[10000]; };
My objective is to pack this buffer across the n/w and recv it on the client. count is a simple counter which i am usign to keep track of the lost/unordered packets is any. My recv system call on the client is as follows. mybuff on the client has been declared of type struct sendbuff.
while(1) //Beggining of While {
while(bytesrcvd<sizeof(mybuff)) {
if ((numbytes=recv(sockfd, (char *)&mybuff, sizeof(mybuff), 0)) == -1) { perror("recv"); exit(1); } bytesrcvd=numbytes+bytesrcvd; }
printf("mybuff.toprint is %s\n",mybuff.toprint); //Problematic printf("mybuff.count is %d\n",mybuff.count); //Problematic
.....etc
} //End of While
On the client mybuff is of type sendbuff. The whole problem is that i am unable to interpret the contents of mybuff which is being used to store the contents of the recv() system call.
Have outlined the two printf() which i need to work out as //problematic. I know this issue centers around the little/big eindian format issue. Am just going round and round in cirles and would apperciate f/b in helping obtain and print the following:
mybuff.toprint and mybuff.count
Also one last thing. As the buffer(toprint) size changes the charactersitics of the problem i face increases..:D.
Thanks in advance folks.
Trevor
|------|____________________________________|------| ( >- / Scaling FreeSoftware & OpenSource \ -< ) /~\ / In the Enterprise \ /~\ | ) \ | www.fsf.org | www.opensource.org | / (/ | |_|_ ____________________________________/ _|_|
__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com