Note that there are some explanatory texts on larger screens.

plurals
  1. POSending image over network c++
    primarykey
    data
    text
    <p>I have problem sending image over the network. but I keep getting error Sending From Client to Server</p> <pre><code>( "msvcr110d.dll" Access violation writing location mov [edi],edx ; store one more dword c++) </code></pre> <p>Any idea what is wrong.</p> <p>Platform: Windows 7 Visual studio c++ 2012 Express C++</p> <p>Send &amp; Receive Message</p> <pre><code>( string ReceiveMyMessage(SOCKET s1) { exception e; try { ZeroMemory(szbuffer,strlen(szbuffer)); if((ibytesrecv = recv(s1,szbuffer,100,0)) == SOCKET_ERROR) throw "Receive error in server program\n"; return ((string) szbuffer); } catch(exception e) { </code></pre> <p>cout&lt;&lt;"Seems Client is Down!\n(SendMyMessage) Error While trying to executing recv command!"&lt; <p>Client Code:</p> <pre><code>void SendStreamFile() { _get_printf_count_output(); struct stat myFileState; int Filesize = 0; char * myDATA; FILE *f = fopen(FileName.c_str(),"rb"); Filesize = (int) myFileState.st_size; myDATA = (char *) malloc(sizeof(char) * Filesize); fread(myDATA,1,Filesize,f); fclose(f); SendMyMessage(to_string( Filesize)); char * ptr; string strToSend = ""; for (int x = 0; x &lt; Filesize; ) { ptr = &amp;myDATA[x]; strToSend.assign(ptr,20); Sleep(100); //cout &lt;&lt; strToSend &lt;&lt;endl; SendMyMessage(strToSend); x = x + 20; cout &lt;&lt; x &lt;&lt; " - " &lt;&lt; Filesize &lt;&lt;endl; } SendMyMessage("*D*"); free(myDATA); } </code></pre> <p>Server Code:</p> <pre><code>void ReceiveClientFileStream(string FileName, SOCKET s1) { string Fsize = ReceiveMyMessage(s1); int Filesize = 0; Filesize= atoi(Fsize.c_str()); char * myDATA; myDATA = new char[Filesize]; cout &lt;&lt; strlen(myDATA) &lt;&lt; Filesize &lt;&lt;endl; //SendMyMessage(to_string( Filesize),s1); //char * ptr = &amp;myDATA[0]; string str = ""; // ZeroMemory(myDATA,Filesize); do { str = ReceiveMyMessage(s1); cout &lt;&lt; str &lt;&lt; endl; if (str.find("*D*") == string::npos) strcat(myDATA,str.c_str()); else { strcat(myDATA,str.substr(str.length()-3, str.length()).c_str()); break; } }while(1); FILE * fil; fil = fopen(FileName.c_str(),"wb"); fwrite(myDATA,sizeof(char),strlen(myDATA),fil); free(myDATA); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload