<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Problem bei Dateiübertragung per Sockets]]></title><description><![CDATA[<p>Hallo!</p>
<p>Ich versuche per Sockets eine Datei zu übertragen, die mehrere MBs groß ist. Dazu verfahre ich beim senden so:</p>
<pre><code class="language-cpp">send(sock,buuuf,strlen(buuuf),0); // Dateilänge übertragen
	is.seekg (0, std::ios::beg);
	while( help &lt; length )
	{
		is.read(buffer,BUF_SIZ);
		while(send(sock,buffer,strlen(buffer),0) &gt; 0);
		is.seekg((help += 4096),std::ios::cur);
	} 
	is.close();
</code></pre>
<p>Und beim empfangen so:</p>
<pre><code class="language-cpp">std::fstream fs;
				int retval = 0;
				for( unsigned long long i = 0; i != length; i+=BUF_SIZ)
				{
					fs.open(&quot;C:/Users/Username/Desktop/hello.txt&quot;,std::ios::binary | std::ios::app);
					while((retval=recv(clients[i],buf2,BUF_SIZ,0))&gt; 0)
					fs.write(buf2,retval);
					//memset(buf2,0,BUF_SIZ);
					fs.close();
					//WriteFile(hFile,buf2,BUF_SIZ,0,&amp;ov);
				}
</code></pre>
<p>Met WriteFile() habe ich es auch schon versucht. Ich bitte um Nachsicht, wenn ihr viele Fehler findet und natürlich um korrektur! Bin vollkommener Neuling bei Sockets.</p>
<p>Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/275661/problem-bei-dateiübertragung-per-sockets</link><generator>RSS for Node</generator><lastBuildDate>Wed, 26 Aug 2026 17:12:25 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/275661.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 18 Oct 2010 19:14:40 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem bei Dateiübertragung per Sockets on Mon, 18 Oct 2010 19:14:40 GMT]]></title><description><![CDATA[<p>Hallo!</p>
<p>Ich versuche per Sockets eine Datei zu übertragen, die mehrere MBs groß ist. Dazu verfahre ich beim senden so:</p>
<pre><code class="language-cpp">send(sock,buuuf,strlen(buuuf),0); // Dateilänge übertragen
	is.seekg (0, std::ios::beg);
	while( help &lt; length )
	{
		is.read(buffer,BUF_SIZ);
		while(send(sock,buffer,strlen(buffer),0) &gt; 0);
		is.seekg((help += 4096),std::ios::cur);
	} 
	is.close();
</code></pre>
<p>Und beim empfangen so:</p>
<pre><code class="language-cpp">std::fstream fs;
				int retval = 0;
				for( unsigned long long i = 0; i != length; i+=BUF_SIZ)
				{
					fs.open(&quot;C:/Users/Username/Desktop/hello.txt&quot;,std::ios::binary | std::ios::app);
					while((retval=recv(clients[i],buf2,BUF_SIZ,0))&gt; 0)
					fs.write(buf2,retval);
					//memset(buf2,0,BUF_SIZ);
					fs.close();
					//WriteFile(hFile,buf2,BUF_SIZ,0,&amp;ov);
				}
</code></pre>
<p>Met WriteFile() habe ich es auch schon versucht. Ich bitte um Nachsicht, wenn ihr viele Fehler findet und natürlich um korrektur! Bin vollkommener Neuling bei Sockets.</p>
<p>Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1967271</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1967271</guid><dc:creator><![CDATA[HELPVISTAWIN7]]></dc:creator><pubDate>Mon, 18 Oct 2010 19:14:40 GMT</pubDate></item><item><title><![CDATA[Reply to Problem bei Dateiübertragung per Sockets on Mon, 18 Oct 2010 19:15:40 GMT]]></title><description><![CDATA[<p><code>#define BUF_SIZ 4096</code></p>
<p>ums nicht zu vergessen...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1967272</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1967272</guid><dc:creator><![CDATA[HELPVISTAWIN7]]></dc:creator><pubDate>Mon, 18 Oct 2010 19:15:40 GMT</pubDate></item><item><title><![CDATA[Reply to Problem bei Dateiübertragung per Sockets on Mon, 18 Oct 2010 19:16:59 GMT]]></title><description><![CDATA[<p>Auf jeden fall funktioniert es nicht. Ich bekomme leider immer nur die ersten paar Bytes. Und zwar sehr oft wiederholt...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1967274</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1967274</guid><dc:creator><![CDATA[HELPVISTAWIN7]]></dc:creator><pubDate>Mon, 18 Oct 2010 19:16:59 GMT</pubDate></item><item><title><![CDATA[Reply to Problem bei Dateiübertragung per Sockets on Mon, 18 Oct 2010 19:21:06 GMT]]></title><description><![CDATA[<p>Du solltest Dir auf jeden Fall die Dokumentation zu send() noch einmal durchlesen, dort steht in der Regel immer etwas, dass die Anzahl der gesendeten Bytes nicht mit der Größe des übergebenen Puffers übereinstimmen muss.</p>
<p>mfg Torsten</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1967277</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1967277</guid><dc:creator><![CDATA[Torsten Robitzki]]></dc:creator><pubDate>Mon, 18 Oct 2010 19:21:06 GMT</pubDate></item><item><title><![CDATA[Reply to Problem bei Dateiübertragung per Sockets on Mon, 18 Oct 2010 19:37:18 GMT]]></title><description><![CDATA[<p>i+=BUF_SIZ und clients[i] sieht verdächtig aus...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1967284</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1967284</guid><dc:creator><![CDATA[theta]]></dc:creator><pubDate>Mon, 18 Oct 2010 19:37:18 GMT</pubDate></item><item><title><![CDATA[Reply to Problem bei Dateiübertragung per Sockets on Mon, 18 Oct 2010 19:39:40 GMT]]></title><description><![CDATA[<p>HELPVISTAWIN7 schrieb:</p>
<blockquote>
<p>Bin vollkommener Neuling bei Sockets.</p>
</blockquote>
<p>Ja und nicht nur da. Lern erstmal Programmieren bevor du mit komplizierten Dingen wie Sockets anfängst.</p>
<pre><code class="language-cpp">send(sock,buffer,strlen(buffer),0)
</code></pre>
<p>Und ein wenig Verständnis für Netzwerkprotokolle bzw. Strings wäre auch nicht schlecht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1967286</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1967286</guid><dc:creator><![CDATA[TyRoXx]]></dc:creator><pubDate>Mon, 18 Oct 2010 19:39:40 GMT</pubDate></item></channel></rss>