<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2168930</guid>
        <pubDate>Thu, 15 Jan 2009 12:55:23 +0000</pubDate>
        <title>Сокеты&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2168930</link>
        <description><![CDATA[kolobok0: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=261937&view=findpost&p=2168031'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>DINETS &#064; <time class="tag-quote__quoted-time" datetime="2009-01-14T19:36:01+03:00">14.01.09, 16:36</time></span><div class='quote '>ну а сам проэкт работает? а то тут некоторые....</div></div><br>
попробуйте прогнать несколько сот метров с одного компа на другой. при этом ещё запустите копирование на передатчике или приёмнике с локального диска на локальный диск...<br>
полученный файл проверьте...лучше какой нить архив прогоните и запустите верифай...<br>
<br>
после того как признаете свою горячность - объясню в чём дело более подробно...<br>
<br>
удачи Вам<br>
(круглый)<br>
ЗЫ<br>
извинения принимаются...все мы такие...]]></description>
        <author>kolobok0</author>
        <category>C/C++: Сетевое программирование</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2168049</guid>
        <pubDate>Wed, 14 Jan 2009 16:55:08 +0000</pubDate>
        <title>Сокеты&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2168049</link>
        <description><![CDATA[DINETS: ЧОРТ я идиот <br>
&#33;&#33;&#33;<br>
спасибо  я ся долбить ща обстену буду блин<br>
 :wall:  :wall:  :wall:  :wall:  :wall: <br>
<br>
<br>
да помнится Энштейн сказал что есть две бесконечности это вселенная и человечкая глупость.<br>
и добавил что в первой он не уверен... <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2009-01-14T17:39:31+00:00">14.01.09, 17:39</time></span></span><br>
..]]></description>
        <author>DINETS</author>
        <category>C/C++: Сетевое программирование</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2168036</guid>
        <pubDate>Wed, 14 Jan 2009 16:40:39 +0000</pubDate>
        <title>Сокеты&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2168036</link>
        <description><![CDATA[Oleg2004: Значит, соединение с сервером установлено было<br>и accept() прошел<br>А recv() вы делаете на акцептированном сокете?<br>те на сокете, который вернула функция аксепт?]]></description>
        <author>Oleg2004</author>
        <category>C/C++: Сетевое программирование</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2168031</guid>
        <pubDate>Wed, 14 Jan 2009 16:36:01 +0000</pubDate>
        <title>Сокеты&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2168031</link>
        <description><![CDATA[DINETS: <div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '>ошибочный recv() этот выполняется в серверном варианте или клиентском?</div></div><br>
да в серверной части ОН Батон 1  яж писал выше <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2009-01-14T16:37:58+00:00">14.01.09, 16:37</time></span></span><br>
ну а сам проэкт работает? а то тут некоторые....]]></description>
        <author>DINETS</author>
        <category>C/C++: Сетевое программирование</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2168023</guid>
        <pubDate>Wed, 14 Jan 2009 16:27:00 +0000</pubDate>
        <title>Сокеты&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2168023</link>
        <description><![CDATA[Oleg2004: Давайте только не будем горячиться.....<br>
Ваши объяснения порой действительно трудно понять<br>
Итак<br>
Вы выполняете: <br>
err=      recv(s,buf,len,0);<br>
и recv() вылетает с ошибкой, что фиксирует:<br>
err=WSAGetLastError ();<br>
те err=10057<br>
Так что ли?<br>
Кстати, так сетевые программы не рекомендуется писать, надо примерно так:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">// connect to server</div><div class="code_line">if ( connect( sock, (sockaddr*) &amp;addr, sizeof( sockaddr ) ) == SOCKET_ERROR )</div><div class="code_line">&nbsp;&nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;int error = WSAGetLastError( );</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if ( ( error != WSAEWOULDBLOCK ) &amp;&amp; ( error != WSAEINPROGRESS ) )</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;fprintf( stderr, &quot;Failed connecting to remote host, %d\n&quot;, error );</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;closesocket(sock);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;exit( 1 );</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script><br>
или так<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&nbsp;if ((numbytes = recv(sock, buff, MAXDATASIZE, 0)) == SOCKET_ERROR)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;cout &#60;&#60; &quot;recv fail with code &quot; &#60;&#60; WSAGetLastError() &#60;&#60; endl;</div></ol></div></div></div></div><br>
И еще <br>
ошибочный recv() этот выполняется в серверном варианте или клиентском?<br>
Я же вас просил - уберите все коменты (трудно отслеживать ваш код, вы же просите помочь, а сами навстречу не идете)и точно укажите тот recv() - их ведь у вас куча - после которого вылетает ошибка. <br>
<br>
<span class="tag-color tag-color-named" data-value="gray" style="color: gray"><span class='tag-size' data-value='7' style='font-size:7pt;'>Добавлено <time class="tag-mergetime" datetime="2009-01-14T16:32:37+00:00">14.01.09, 16:32</time></span></span><br>
Нда......<br>
Посмотрел на ваш проект......... &lt;_&lt;]]></description>
        <author>Oleg2004</author>
        <category>C/C++: Сетевое программирование</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2168001</guid>
        <pubDate>Wed, 14 Jan 2009 16:09:57 +0000</pubDate>
        <title>Сокеты&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2168001</link>
        <description><![CDATA[DINETS: вот]]></description>
        <author>DINETS</author>
        <category>C/C++: Сетевое программирование</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2167959</guid>
        <pubDate>Wed, 14 Jan 2009 15:39:43 +0000</pubDate>
        <title>Сокеты&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2167959</link>
        <description><![CDATA[DINETS: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=261937&view=findpost&p=2164682'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>DINETS &#064; <time class="tag-quote__quoted-time" datetime="2009-01-11T13:12:17+00:00">11.01.09, 13:12</time></span><div class='quote '>всё начал понимать повторный вызов рецив (после удачного) возвращает WSAENOTCONN (10057) <br>
&quot;<br>
Socket is not connected. <br>
A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using sendto) no address was supplied. Any other type of operation might also return this error - for example, setsockopt setting SO_KEEPALIVE if the connection has been reset. <br>
&quot;<br>
я понял что нада сделать КИП ЭЛАЙВ хорошо<br>
а если без этого как сделать реконект?</div></div><br>
я чо на инопланетном говорю или тут у когото мозг в черепе не вмещается???&#33;<br>
<br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">err= &nbsp; &nbsp; &nbsp;recv(s,buf,len,0);</div><div class="code_line">err=WSAGetLastError ();</div></ol></div></div></div></div><br>
при приёме не входя в цикл (при маленьком файле хотя в цикле тоже)<br>
<br>
вот тут ошибка&#33;<br>
и всё больше негде и КОД РАБОЧИЙ&#33;]]></description>
        <author>DINETS</author>
        <category>C/C++: Сетевое программирование</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2167529</guid>
        <pubDate>Wed, 14 Jan 2009 10:11:18 +0000</pubDate>
        <title>Сокеты&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2167529</link>
        <description><![CDATA[kolobok0: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=261937&view=findpost&p=2167256'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>DINETS &#064; <time class="tag-quote__quoted-time" datetime="2009-01-13T21:00:30+00:00">13.01.09, 21:00</time></span><div class='quote '>...вобще замечание оффтоп так как НИЧЕГО неприходит&#33; да я знаю что в пакеты оно группируется но тут это вобще не к месту оно рвётся чегото&#33;&#33;&#33;&#33;...</div></div><br>
1) что значит оффтоп? т.е. до этого куска кода не доходит? почему тогда вводите в заблуждение надписью что работает до сих пор? Просто так поприкалываться захотелось?<br>
2) в пакеты ПРИ ЮЗАНЬЕ TCP слоя как раз НЕ формируются. потому как НЕТ ПОНЯТИЯ ПАКЕТЫ...есть понятие ПОТОК..почуствуйте разницу...<br>
3) Приведённый код НЕ РАБОЧИЙ...<br>
4) Расшифруйте термин &quot;рвёться&quot;. где, что рвёться. помню у одного человека тут не рвалось пол года...но то другая история...<br>
<br>
происходит эксепшен...<br>
с чего вы взяли что рвёться? нет такого понятия в МСДНе...<br>
есть при вызове функции(метода) такого то, возврат такой...должно быть(ожидаю) такой...<br>
сделал то-то и то-то...включил анализатор...приходят(не приходят) пакеты такие то...<br>
<br>
а то какое то гадание на кофейне...<br>
<br>
удачи Вам<br>
(круглый)<br>
ЗЫ<br>
Заметьте время теряется из за недопонимания...<br>
ЗЫ ЗЫ<br>
детский сад...]]></description>
        <author>kolobok0</author>
        <category>C/C++: Сетевое программирование</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2167410</guid>
        <pubDate>Wed, 14 Jan 2009 07:12:09 +0000</pubDate>
        <title>Сокеты&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2167410</link>
        <description><![CDATA[popsa: проверку на send/recv не забудь ;) <br>
наподобие send сделай(R_ERROR = -1, R_OK = 0)<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">int MDRVSSend(const SOCKET sock, const char *send_msg, const WORD send_size)</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp; &nbsp;if(!send_msg || send_size &#60; 0) return R_ERROR;</div><div class="code_line">&nbsp;&nbsp; &nbsp;int sended = 0, total_sended = 0, counter = 0;</div><div class="code_line">&nbsp;&nbsp; &nbsp;while(sended &#60; send_size)</div><div class="code_line">&nbsp;&nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;sended = send(sock, send_msg + total_sended, send_size - total_sended, 0);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if(sended == SOCKET_ERROR)</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if(WSAGetLastError() == WSAEWOULDBLOCK) </div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if(counter &#62; 10) return R_ERROR;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;counter++;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;continue; </div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;else break;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;total_sended += sended;</div><div class="code_line">&nbsp;&nbsp; &nbsp;}</div><div class="code_line">&nbsp;&nbsp; &nbsp;return total_sended == send_size ? R_OK : R_ERROR;</div><div class="code_line">}</div></ol></div></div></div></div>]]></description>
        <author>popsa</author>
        <category>C/C++: Сетевое программирование</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2167256</guid>
        <pubDate>Tue, 13 Jan 2009 21:00:30 +0000</pubDate>
        <title>Сокеты&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2167256</link>
        <description><![CDATA[DINETS: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=261937&view=findpost&p=2166986'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>kolobok0 &#064; <time class="tag-quote__quoted-time" datetime="2009-01-13T16:35:28+00:00">13.01.09, 16:35</time></span><div class='quote '><div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=261937&view=findpost&p=2164278'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>DINETS &#064; <time class="tag-quote__quoted-time" datetime="2009-01-10T23:40:47+00:00">10.01.09, 23:40</time></span><div class='quote '>сокет работает только в начале ...</div></div><br>
а с чего вы взяли что принимаете весь буффер передачи?<br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">while (len&#62;=BUF_SIZE)</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp;err = recv(s, buf, BUF_SIZE, 0);</div><div class="code_line">&nbsp;&nbsp;fwrite(buf, sizeof(char), BUF_SIZE, file);</div><div class="code_line">//send(s_new,&quot;OK{text}&quot;,3,0);</div><div class="code_line">&nbsp;&nbsp;len = len - BUF_SIZE;</div><div class="code_line">}</div></ol></div></div></div></div><br>
<br>
Типа сами так хотите?<br>
Вы должны проверять на кол-во принятых байт и именно это значение минусовать от общей длины. TCP Вам НЕ гарантирует приход ПАКЕТОВ(читай квантов передачи&#33;&#33;&#33;) он гарантирует ПОТОК. А это РАЗНЫЕ вещи&#33;&#33;&#33;<br>
<br>
удачи Вам<br>
(круглый)<br>
ЗЫ<br>
Самая распространённая ошибка при TCP юзанье..</div></div><br>
вобще замечание оффтоп так как НИЧЕГО неприходит&#33; да я знаю что в пакеты оно группируется но тут это вобще не к месту оно рвётся чегото&#33;&#33;&#33;&#33; <br>
лучшеб чтото более нужное посоветывали]]></description>
        <author>DINETS</author>
        <category>C/C++: Сетевое программирование</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2166986</guid>
        <pubDate>Tue, 13 Jan 2009 16:35:28 +0000</pubDate>
        <title>Сокеты&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2166986</link>
        <description><![CDATA[kolobok0: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=261937&view=findpost&p=2164278'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>DINETS &#064; <time class="tag-quote__quoted-time" datetime="2009-01-10T23:40:47+00:00">10.01.09, 23:40</time></span><div class='quote '>сокет работает только в начале ...</div></div><br>
а с чего вы взяли что принимаете весь буффер передачи?<br>
<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">while (len&#62;=BUF_SIZE)</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp;err = recv(s, buf, BUF_SIZE, 0);</div><div class="code_line">&nbsp;&nbsp;fwrite(buf, sizeof(char), BUF_SIZE, file);</div><div class="code_line">//send(s_new,&quot;OK{text}&quot;,3,0);</div><div class="code_line">&nbsp;&nbsp;len = len - BUF_SIZE;</div><div class="code_line">}</div></ol></div></div></div></div><br>
<br>
Типа сами так хотите?<br>
Вы должны проверять на кол-во принятых байт и именно это значение минусовать от общей длины. TCP Вам НЕ гарантирует приход ПАКЕТОВ(читай квантов передачи&#33;&#33;&#33;) он гарантирует ПОТОК. А это РАЗНЫЕ вещи&#33;&#33;&#33;<br>
<br>
удачи Вам<br>
(круглый)<br>
ЗЫ<br>
Самая распространённая ошибка при TCP юзанье..]]></description>
        <author>kolobok0</author>
        <category>C/C++: Сетевое программирование</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2166935</guid>
        <pubDate>Tue, 13 Jan 2009 15:48:06 +0000</pubDate>
        <title>Сокеты&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2166935</link>
        <description><![CDATA[Oleg2004: IPPROTO_TCP 		<br>Константа для указания уровня TCP.<br>TCP_KEEPALIVE	<br>Устанавливает интервал времени между пакетами &quot;keep alive&quot; в секундах. Вначале следует активировать опцию SO_KEEPALIVE. <br><br>Как я уже отметил, для вас это не является необходимым.]]></description>
        <author>Oleg2004</author>
        <category>C/C++: Сетевое программирование</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2166319</guid>
        <pubDate>Tue, 13 Jan 2009 08:07:00 +0000</pubDate>
        <title>Сокеты&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2166319</link>
        <description><![CDATA[DINETS: TCP_KEEPALIVE ??? а де это? может setsockopt(s,IPPROTO_TCP1,SO_KEEPALIVE,(const char *)&amp;opt,sizeof(int));<br>ибо TCP_KEEPALIVE нет, а для уровня IPPROTO_TCP1 есть только тотже SO_KEEPALIVE <br><br><br>ну какие будут идеи ????????<br>а совсем забыл студия 6 у меня]]></description>
        <author>DINETS</author>
        <category>C/C++: Сетевое программирование</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2166034</guid>
        <pubDate>Mon, 12 Jan 2009 20:20:25 +0000</pubDate>
        <title>Сокеты&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2166034</link>
        <description><![CDATA[Oleg2004: err= setsockopt(s,SOL_SOCKET,SO_KEEPALIVE,(const char *)&amp;opt,sizeof(int));<br>Если вы думаете, что эта опция поддерживает соединение живым (открытым) - так это не так.<br>Ее кстати надо совместно с TCP_KEEPALIVE использовать...<br>Да, уберите из кода все лишнее закоменченное - никак не позволяет сосредоточиться.<br>И укажите точно, где и кто затыкается - неясно. Инструкция ---- и ошибка.]]></description>
        <author>Oleg2004</author>
        <category>C/C++: Сетевое программирование</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2165986</guid>
        <pubDate>Mon, 12 Jan 2009 19:48:19 +0000</pubDate>
        <title>Сокеты&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2165986</link>
        <description><![CDATA[DINETS: <div class='tag-quote'><a class='tag-quote-link' href='https://forum.sources.ru/index.php?showtopic=261937&view=findpost&p=2165702'><span class='tag-quote-prefix'>Цитата</span></a> <span class='tag-quote__quote-info'>Oleg2004 &#064; <time class="tag-quote__quoted-time" datetime="2009-01-12T15:13:32+00:00">12.01.09, 15:13</time></span><div class='quote '>Скорее всего вы рановато закрываете серверный присоединенный сокет</div></div><br>
ГДЕ??? в том то и дело где я его закрываю?&#33;?&#33;?]]></description>
        <author>DINETS</author>
        <category>C/C++: Сетевое программирование</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2165702</guid>
        <pubDate>Mon, 12 Jan 2009 15:13:32 +0000</pubDate>
        <title>Сокеты&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2165702</link>
        <description><![CDATA[Oleg2004: Скорее всего вы рановато закрываете серверный присоединенный сокет]]></description>
        <author>Oleg2004</author>
        <category>C/C++: Сетевое программирование</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2165692</guid>
        <pubDate>Mon, 12 Jan 2009 15:05:38 +0000</pubDate>
        <title>Сокеты&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2165692</link>
        <description><![CDATA[DINETS: да прога и клиент и сервер естественно для отладки надо 2 запущеных приложения<br>
 <br>
в мсходниках я написал пометки где у меня до какого момента всё класс и ошибок нет никаких<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">////////////////// до этого момента всё класс!/////////////////////////////////</div></ol></div></div></div></div>]]></description>
        <author>DINETS</author>
        <category>C/C++: Сетевое программирование</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2165239</guid>
        <pubDate>Mon, 12 Jan 2009 06:55:42 +0000</pubDate>
        <title>Сокеты&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2165239</link>
        <description><![CDATA[Oleg2004: void CFtransDlg::OnButton1() - запускается TCP-сервер<br>void CFtransDlg::OnButton2() - запускается TCP-клиент<br>Они в одном программном модуле? т.е. разными кнопками программа выходит или в режим клиента, или сервера.<br>Тут можно поподробнее?]]></description>
        <author>Oleg2004</author>
        <category>C/C++: Сетевое программирование</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2164743</guid>
        <pubDate>Sun, 11 Jan 2009 14:18:02 +0000</pubDate>
        <title>Сокеты&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2164743</link>
        <description><![CDATA[DINETS: 1. стрим<br>
2. да успешно и более того (пишу простенькую прогу передачи файла) передаю и ПОЛУЧАЮ размер файла в байтах но больше ничего<br>
3. сенд<br>
4. рецив<br>
5. дебагом видел что размер он получает плюс создаются пустые файлы нучжного размера<br>
6. код ы<br>
приём<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">void CFtransDlg::OnButton1() </div><div class="code_line">{</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;WORD wVersionRequested;</div><div class="code_line">WSADATA wsaData;</div><div class="code_line">int err;</div><div class="code_line">&nbsp;</div><div class="code_line">wVersionRequested = MAKEWORD( 2, 0 );</div><div class="code_line">&nbsp;</div><div class="code_line">err = WSAStartup( wVersionRequested, &amp;wsaData );</div><div class="code_line">if ( err != 0 ) {</div><div class="code_line">&nbsp;&nbsp; &nbsp;/* Tell the user that we could not find a usable */</div><div class="code_line">&nbsp;&nbsp; &nbsp;/* WinSock DLL. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</div><div class="code_line">&nbsp;&nbsp; &nbsp;return;</div><div class="code_line">}</div><div class="code_line">////////////////////////////////////////////////////////////////////////////////////////////////</div><div class="code_line">UpdateData(1);</div><div class="code_line">&nbsp;&nbsp;#define SRV_PORT 1234 &nbsp;</div><div class="code_line">&nbsp;&nbsp;#define BUF_SIZE 1000 &nbsp;</div><div class="code_line">&nbsp;&nbsp;#define TXT_QUEST &quot;Who are you?\n&quot; &nbsp; </div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;int s, s_new; </div><div class="code_line">&nbsp;&nbsp; &nbsp;int from_len; </div><div class="code_line">&nbsp;&nbsp; &nbsp;</div><div class="code_line">// &nbsp;char buf [64];</div><div class="code_line">&nbsp;&nbsp; &nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;struct sockaddr_in sin, from_sin; &nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;s = socket (AF_INET, SOCK_STREAM, 0); </div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;memset ((char *)&amp;sin, &#39;{text}&#39;, sizeof(sin)); </div><div class="code_line">&nbsp;&nbsp; &nbsp;sin.sin_family = AF_INET; </div><div class="code_line">&nbsp;&nbsp; &nbsp;sin.sin_addr.s_addr = INADDR_ANY; </div><div class="code_line">&nbsp;int PortNum;</div><div class="code_line">PortNum = atoi(m_hp.operator LPCTSTR());</div><div class="code_line">&nbsp;&nbsp; &nbsp;sin.sin_port = htons(PortNum); </div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;bind (s, (struct sockaddr *)&amp;sin, sizeof(sin)); </div><div class="code_line">&nbsp;err= &nbsp; listen (s,SOMAXCONN); </div><div class="code_line">&nbsp;&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; from_len = sizeof(from_sin); </div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;s_new = accept (s, ( struct sockaddr *)&amp;from_sin, &amp;from_len); </div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;char b[20]={0};</div><div class="code_line">&nbsp;</div><div class="code_line">recv(s_new,b,20,0);//////////////////////////////////////////////////////////////</div><div class="code_line">&nbsp;</div><div class="code_line">long bytes;</div><div class="code_line">long len;</div><div class="code_line">&nbsp;</div><div class="code_line">//bytes=atoi(b);</div><div class="code_line">sscanf(b,&quot;%d&quot;,&amp;bytes);</div><div class="code_line">&nbsp;</div><div class="code_line">//send(s_new,&quot;OK&quot;,3,0);//////////////////////////////////////////////////////////////////</div><div class="code_line">len=bytes;</div><div class="code_line">//len=50;/////////////////////////////////////////////////</div><div class="code_line">FILE *file;</div><div class="code_line">file=fopen(m_file.operator LPCTSTR(),&quot;w+&quot;);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">char buf[1500]={0};</div><div class="code_line">////////////////// до этого момента всё класс!/////////////////////////////////</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp;while (len&#62;=BUF_SIZE)</div><div class="code_line">{</div><div class="code_line">&nbsp;&nbsp; &nbsp;err= &nbsp;recv(s,buf,BUF_SIZE,0);</div><div class="code_line">fwrite(buf,sizeof(char),BUF_SIZE,file);</div><div class="code_line">//send(s_new,&quot;OK{text}&quot;,3,0);</div><div class="code_line">&nbsp;</div><div class="code_line">len=len-BUF_SIZE;</div><div class="code_line">}</div><div class="code_line">err= &nbsp; &nbsp; &nbsp;recv(s,buf,len,0);</div><div class="code_line">err=WSAGetLastError ();</div><div class="code_line">::AfxMessageBox(buf,0,0);</div><div class="code_line">fwrite(buf,sizeof(char),len,file);</div><div class="code_line">//send(s_new,&quot;OK{text}&quot;,3,0);</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;shutdown (s_new, 0); </div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp;closesocket(s_new); </div><div class="code_line">&nbsp;WSACleanup ();</div><div class="code_line">&nbsp;&nbsp; &nbsp;fclose(file);</div><div class="code_line">}</div></ol></div></div></div></div><br>
отсыл <br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">void CFtransDlg::OnButton2() </div><div class="code_line">{ &nbsp; #define BUF_SIZE 1000 </div><div class="code_line">&nbsp;&nbsp; &nbsp;UpdateData(1);</div><div class="code_line">WORD wVersionRequested;</div><div class="code_line">WSADATA wsaData;</div><div class="code_line">int err;</div><div class="code_line">&nbsp;</div><div class="code_line">wVersionRequested = MAKEWORD( 2, 0 );</div><div class="code_line">&nbsp;</div><div class="code_line">err = WSAStartup( wVersionRequested, &amp;wsaData );</div><div class="code_line">if ( err != 0 ) {</div><div class="code_line">&nbsp;&nbsp; &nbsp;/* Tell the user that we could not find a usable */</div><div class="code_line">&nbsp;&nbsp; &nbsp;/* WinSock DLL. &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;*/</div><div class="code_line">&nbsp;&nbsp; &nbsp;return;</div><div class="code_line">}</div><div class="code_line">&nbsp;</div><div class="code_line">//::AfxMessageBox(&quot;STOP03&quot;,0,0);</div><div class="code_line">SOCKET s = socket(AF_INET, SOCK_STREAM, 0);</div><div class="code_line">&nbsp;//hostent* hp;</div><div class="code_line">struct hostent* &nbsp;hp;</div><div class="code_line">&nbsp;&nbsp;char b[20]={0};</div><div class="code_line">&nbsp;&nbsp;char *pdest;</div><div class="code_line">&nbsp;&nbsp; pdest = strchr( m_hp.operator LPCTSTR(), &#39;:&#39; );</div><div class="code_line">&nbsp;&nbsp; *pdest=0;</div><div class="code_line">&nbsp;&nbsp; pdest++;</div><div class="code_line">&nbsp;&nbsp; int i=0;</div><div class="code_line">&nbsp;&nbsp; while(*pdest!=0)</div><div class="code_line">&nbsp;&nbsp; { &nbsp; &nbsp; &nbsp; b[i]=*pdest;</div><div class="code_line">i++;</div><div class="code_line">pdest++;</div><div class="code_line">&nbsp;&nbsp; }</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">//::AfxMessageBox(&quot;STOP02&quot;,0,0);</div><div class="code_line">&nbsp;&nbsp;if( (hp=gethostbyname(m_hp.operator LPCTSTR())) == NULL &nbsp;)</div><div class="code_line">&nbsp;&nbsp;{</div><div class="code_line">&nbsp;&nbsp; &nbsp; return ;</div><div class="code_line">&nbsp;&nbsp;}</div><div class="code_line">struct sockaddr_in ssin;</div><div class="code_line">memset ((char *)&amp;ssin, &#39;{text}&#39;, sizeof(ssin));</div><div class="code_line">&nbsp;// memcpy(hp-&#62;h_addr_list, &amp;ssin.sin_addr, hp-&#62;h_length);</div><div class="code_line">&nbsp;// ssin.sin_addr.s_addr=*(unsigned long*)(hp-&#62;h_addr);</div><div class="code_line">&nbsp;</div><div class="code_line">ssin.sin_addr.S_un.S_addr = inet_addr(m_hp.operator LPCTSTR());</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp;ssin.sin_family = hp-&#62;h_addrtype;</div><div class="code_line">&nbsp;&nbsp;int PortNum;</div><div class="code_line">PortNum = atoi(b);</div><div class="code_line">&nbsp;</div><div class="code_line">ssin.sin_port = htons(PortNum);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">//::AfxMessageBox(&quot;STOP01&quot;,0,0);</div><div class="code_line">&nbsp;if(connect(s, (struct sockaddr *)&amp;ssin, sizeof(ssin))==-1){</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; return ;</div><div class="code_line">&nbsp;&nbsp;}</div><div class="code_line">&nbsp;CFile file;</div><div class="code_line">&nbsp;file.Open(m_file.operator LPCTSTR(),CFile::modeRead,NULL);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;//long len;</div><div class="code_line">&nbsp;long len= file.GetLength();</div><div class="code_line">&nbsp;</div><div class="code_line">sprintf(b,&quot;%d&quot;,len);</div><div class="code_line">//sprintf(b,&quot;%d&quot;,len);</div><div class="code_line">&nbsp;&nbsp;char buf[1500]; </div><div class="code_line">&nbsp;&nbsp;bool opt;</div><div class="code_line">&nbsp;&nbsp;opt=true;</div><div class="code_line">&nbsp;err= setsockopt(s,SOL_SOCKET,SO_KEEPALIVE,(const char *)&amp;opt,sizeof(int));</div><div class="code_line">&nbsp;err=send(s,b,strlen(b),0);////////////////////////////////////////////////////</div><div class="code_line">err= setsockopt(s,SOL_SOCKET,SO_KEEPALIVE,(const char *)&amp;opt,sizeof(int));</div><div class="code_line">&nbsp;//recv(s,buf,3,0);//////////////////////////////////////////////////////////</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">////////////////// до этого момента всё класс!/////////////////////////////////</div><div class="code_line">while (len&#62;=BUF_SIZE)</div><div class="code_line">{</div><div class="code_line">file.Read(buf,BUF_SIZE);</div><div class="code_line">err=send(s,buf,BUF_SIZE,0);</div><div class="code_line">&nbsp;//recv(s,buf,4,0);</div><div class="code_line">len=len-BUF_SIZE;</div><div class="code_line">}</div><div class="code_line">file.Read(buf,len);</div><div class="code_line">::AfxMessageBox(buf,0,0);</div><div class="code_line">err=send(s,buf,len,0);</div><div class="code_line">err=WSAGetLastError ();</div><div class="code_line">// recv(s,buf,4,0);</div><div class="code_line">//Sleep(9000);</div><div class="code_line">::AfxMessageBox(&quot;STOP00&quot;,0,0);</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp;shutdown (s, 0); </div><div class="code_line">&nbsp;&nbsp; &nbsp;closesocket(s); </div><div class="code_line">&nbsp;&nbsp; &nbsp; WSACleanup ();</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;file.Close();</div><div class="code_line">}</div></ol></div></div></div></div>]]></description>
        <author>DINETS</author>
        <category>C/C++: Сетевое программирование</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2164687</guid>
        <pubDate>Sun, 11 Jan 2009 13:14:49 +0000</pubDate>
        <title>Сокеты&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2164687</link>
        <description><![CDATA[LuckLess: ты написал какуюто муть. &quot;КИП ЭЛАЙВ&quot; тут не причем.<br>1. какой сокет создаеш (протокол)<br>2. конектишся или нет?<br>3. как посылаеш данные<br>4. как принимаеш<br>5. откуда уверенность что сервер не обрывает коннект так как ты ему не нравишся?<br>6. код покажи]]></description>
        <author>LuckLess</author>
        <category>C/C++: Сетевое программирование</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2164682</guid>
        <pubDate>Sun, 11 Jan 2009 13:12:17 +0000</pubDate>
        <title>Сокеты&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2164682</link>
        <description><![CDATA[DINETS: всё начал понимать повторный вызов рецив (после удачного) возвращает WSAENOTCONN (10057) <br>&quot;<br>Socket is not connected. <br>A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using sendto) no address was supplied. Any other type of operation might also return this error - for example, setsockopt setting SO_KEEPALIVE if the connection has been reset. <br>&quot;<br>я понял что нада сделать КИП ЭЛАЙВ хорошо<br>а если без этого как сделать реконект?]]></description>
        <author>DINETS</author>
        <category>C/C++: Сетевое программирование</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2164294</guid>
        <pubDate>Sun, 11 Jan 2009 02:02:29 +0000</pubDate>
        <title>Сокеты&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2164294</link>
        <description><![CDATA[Dem_max: Наверное все таки исходника.]]></description>
        <author>Dem_max</author>
        <category>C/C++: Сетевое программирование</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2164278</guid>
        <pubDate>Sat, 10 Jan 2009 23:40:47 +0000</pubDate>
        <title>Сокеты&amp;#33;</title>
        <link>https://forum.sources.ru/index.php?showtopic=261937&amp;view=findpost&amp;p=2164278</link>
        <description><![CDATA[DINETS: сокет работает только в начале <br>потом ресив ничего не принимает<br> хотя первая передача успешна<br>уверне что нехватает толи сбраса или ещё чегото]]></description>
        <author>DINETS</author>
        <category>C/C++: Сетевое программирование</category>
      </item>
	
      </channel>
      </rss>
	