<< split from this >>

>u asking me if i cant code why should i be asking about sockets?
No, I was asking you what you know so we don't waste time going over things that we don't need to. But if you want to be a dick about it, just say the word and I'll ignore you so that I can do more interesting things.

>"yes i can"
This answer is worthless. So, since you seem incapable of giving me enough information to properly help you, I'll require that you post a complete program that shows an honest attempt to solve the problem.

Hello, I have the same issue to solve. My client is on wingoze, and the server is on linux. Now my file to send is a picture :(. Yes, I know how to work with sockets(text sent from one end to another and back). So Narue, you're suggesting to open the file for reading ( pf=fopen("file.jpg","r")) and copy character by character into a buffer, the send the buffer(this is on the server side)? :D....and in the client, receive the buffer and create a .jpg file: pf = fopen("newfile.jpg","w"), and put the buffer there? :-|.


My client is on wingoze

What is wingoze? Whatever it is, it may be an Operating system, and there should be a socket API for it. Look that up.

Comments
random rep++ from salem

sorry for this late late reply, but i haven't noticed the notification mail in my inbox :( . wingoze=Windows. And anyways, thanks for your post, i solved that problem a looong time ago.

Cheers!

Radu

Dustman can you please send me your code...I am having problem in writing the JPG file...I can receive same amnt data but unable to read from buffer and write to jpg file. every time a jpg file created which doesnt have anythng.. so if u can send me ur client code that would be great

I think this calls for a shot of FACEPALM

+1

@niku4u - Sorry, but I don't have the code, since I had this problem almost 2 years ago...it's been a long time.

Regards,

Radu

Following is my client code....I am receiving data of equal size of JPG file... so if anyone can help me out with reading buffer properly and writing it in to jpg file at client side

do
{
    memset(buffer,0x0,BUFFER_SIZE);    //  init line 
    rc = read(sd, buffer, BUFFER_SIZE);
    if( rc > 0)
    { 
        printf("%s",buffer);
        size +=rc;
    }
//      printf("  %d  ",size);
}while(rc>0);



     pFile = fopen ( "new.jpg" , "wb" );
     fwrite (buffer, 1 , size , pFile );
     fclose (pFile);


printf("\n   Total received response bytes: %d\n",size);

// return
close(sd);

Edited 3 Years Ago by pritaeas: Fixed formatting

yeah sure. we can help.

This thread has been marked solved.
Perhaps start a new thread instead?

and this time, you can even use code tags.

Edited 3 Years Ago by Reverend Jim: Fixed formatting

This question has already been answered. Start a new discussion instead.