<?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[recv haengt?]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich verwende BDS2006 und wollte keine Komponente von Borland verwenden sondern alles selbst machen (umstieg von linux c auf windows c++ <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /> )<br />
auf meinem apache wird die verbindung angezeigt, senden kann ich auch, aber leider bleibt das program im recv() aufruf haengen? hier der code:</p>
<pre><code>char buf[5000];
	int iReturn;

	memset(&amp;SockAddr,0,sizeof(SOCKADDR_IN));
	memset(&amp;Socket, 0, sizeof(SOCKET));

	prv_AddToProtocol(&quot;Creating the socket...&quot;);
	Socket = socket(AF_INET, SOCK_STREAM, 0);
	if(Socket == INVALID_SOCKET)
	{
		prv_AddToProtocol(&quot;Error creating socket! ErrorCode: &quot; + IntToStr(socket));
		return;
	}
	prv_AddToProtocol(&quot;Socket created!&quot;);

	SockAddr.sin_port = htons((u_short)EditPort-&gt;Text.ToInt());
	SockAddr.sin_family = AF_INET;
	SockAddr.sin_addr.S_un.S_addr = inet_addr(EditServer-&gt;Text.c_str());
	if(SockAddr.sin_addr.S_un.S_addr == NULL) //user entered not an ip
	{
		//todo
		gethostbyname(EditServer-&gt;Text.c_str());
	}

	prv_AddToProtocol(&quot;Connecting...&quot;);
	iReturn = connect(Socket, (sockaddr*)&amp;SockAddr, sizeof(sockaddr));
	if(iReturn == SOCKET_ERROR)
	{
		prv_AddToProtocol(&quot;Error connecting! ErrorCode: &quot; + IntToStr(WSAGetLastError()));
		return;
	}
	prv_AddToProtocol(&quot;Connected!&quot;);

	sockaddr *from;
	int fromlen;
	//now create the listen/send thread
	//RecvThread *tThread = new RecvThread(false);

   sendto(Socket, &quot;NICK nick1236&quot;, 14, 0, (SOCKADDR*)&amp;SockAddr, sizeof(SOCKADDR_IN));
   prv_AddToProtocol(&quot;NICK send&quot;);
   recv(Socket, buf, sizeof(buf), MSG_PEEK);
   //recvfrom(Socket, buf, 500, 0, from, &amp;fromlen);
   prv_AddToProtocol((AnsiString)buf);
</code></pre>
<p>ich habs auch schon in nem thread versucht alle 100ms abzufragen (den socket), genauso in einer while schleife... gleiche ergebnis; das program springt einmal in recv und bleibt haengen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f621.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--pouting_face"
      title=":rage:"
      alt="😡"
    /><br />
hab langsam echt keine lust mehr auf die windows kacke - scheiss doku - komische begriffe... unter linux war das alles schoen klar deutlich, manpages etc.<br />
bin fuer jede hilfe dankbar</p>
<p>lg</p>
<p>oli</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/131156/recv-haengt</link><generator>RSS for Node</generator><lastBuildDate>Fri, 10 Jul 2026 23:49:37 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/131156.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 31 Dec 2005 15:54:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to recv haengt? on Sat, 31 Dec 2005 15:54:27 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich verwende BDS2006 und wollte keine Komponente von Borland verwenden sondern alles selbst machen (umstieg von linux c auf windows c++ <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /> )<br />
auf meinem apache wird die verbindung angezeigt, senden kann ich auch, aber leider bleibt das program im recv() aufruf haengen? hier der code:</p>
<pre><code>char buf[5000];
	int iReturn;

	memset(&amp;SockAddr,0,sizeof(SOCKADDR_IN));
	memset(&amp;Socket, 0, sizeof(SOCKET));

	prv_AddToProtocol(&quot;Creating the socket...&quot;);
	Socket = socket(AF_INET, SOCK_STREAM, 0);
	if(Socket == INVALID_SOCKET)
	{
		prv_AddToProtocol(&quot;Error creating socket! ErrorCode: &quot; + IntToStr(socket));
		return;
	}
	prv_AddToProtocol(&quot;Socket created!&quot;);

	SockAddr.sin_port = htons((u_short)EditPort-&gt;Text.ToInt());
	SockAddr.sin_family = AF_INET;
	SockAddr.sin_addr.S_un.S_addr = inet_addr(EditServer-&gt;Text.c_str());
	if(SockAddr.sin_addr.S_un.S_addr == NULL) //user entered not an ip
	{
		//todo
		gethostbyname(EditServer-&gt;Text.c_str());
	}

	prv_AddToProtocol(&quot;Connecting...&quot;);
	iReturn = connect(Socket, (sockaddr*)&amp;SockAddr, sizeof(sockaddr));
	if(iReturn == SOCKET_ERROR)
	{
		prv_AddToProtocol(&quot;Error connecting! ErrorCode: &quot; + IntToStr(WSAGetLastError()));
		return;
	}
	prv_AddToProtocol(&quot;Connected!&quot;);

	sockaddr *from;
	int fromlen;
	//now create the listen/send thread
	//RecvThread *tThread = new RecvThread(false);

   sendto(Socket, &quot;NICK nick1236&quot;, 14, 0, (SOCKADDR*)&amp;SockAddr, sizeof(SOCKADDR_IN));
   prv_AddToProtocol(&quot;NICK send&quot;);
   recv(Socket, buf, sizeof(buf), MSG_PEEK);
   //recvfrom(Socket, buf, 500, 0, from, &amp;fromlen);
   prv_AddToProtocol((AnsiString)buf);
</code></pre>
<p>ich habs auch schon in nem thread versucht alle 100ms abzufragen (den socket), genauso in einer while schleife... gleiche ergebnis; das program springt einmal in recv und bleibt haengen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f621.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--pouting_face"
      title=":rage:"
      alt="😡"
    /><br />
hab langsam echt keine lust mehr auf die windows kacke - scheiss doku - komische begriffe... unter linux war das alles schoen klar deutlich, manpages etc.<br />
bin fuer jede hilfe dankbar</p>
<p>lg</p>
<p>oli</p>
]]></description><link>https://www.c-plusplus.net/forum/post/953537</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/953537</guid><dc:creator><![CDATA[Oli21]]></dc:creator><pubDate>Sat, 31 Dec 2005 15:54:27 GMT</pubDate></item><item><title><![CDATA[Reply to recv haengt? on Sat, 31 Dec 2005 16:12:51 GMT]]></title><description><![CDATA[<p>Warum benutzt du sendto? Welches Protokoll implementierst du?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/953549</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/953549</guid><dc:creator><![CDATA[...........]]></dc:creator><pubDate>Sat, 31 Dec 2005 16:12:51 GMT</pubDate></item><item><title><![CDATA[Reply to recv haengt? on Sat, 31 Dec 2005 16:20:30 GMT]]></title><description><![CDATA[<p>Es beleibt vermutlich hängen, weil keine Daten kommen, oder?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/953557</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/953557</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Sat, 31 Dec 2005 16:20:30 GMT</pubDate></item><item><title><![CDATA[Reply to recv haengt? on Sat, 31 Dec 2005 16:30:10 GMT]]></title><description><![CDATA[<p>hallo, verwende tcp<br />
ja das keine daten kommen - davon gehe ich wohl auch aus... aber wieso?<br />
es muessen daten kommen - ich schick vorher mist hin und der apache sollte drauf antworten, oder? mind. ein &quot;unknown command&quot; oderso sollte zurueck kommen, das funzt ja auch wenn ich per telnet drauf connecte...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/953563</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/953563</guid><dc:creator><![CDATA[Oli21]]></dc:creator><pubDate>Sat, 31 Dec 2005 16:30:10 GMT</pubDate></item><item><title><![CDATA[Reply to recv haengt? on Sat, 31 Dec 2005 16:37:29 GMT]]></title><description><![CDATA[<p>Mit wem Kommunizierst Du denn? Mit einem Web-Server? Warum sollte er Dir antworten, wenn Du noch keine gültige Anfrage geschickt hast (also ein alleinstehendes NewLine)?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/953565</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/953565</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Sat, 31 Dec 2005 16:37:29 GMT</pubDate></item><item><title><![CDATA[Reply to recv haengt? on Sat, 31 Dec 2005 16:43:03 GMT]]></title><description><![CDATA[<p>kann ja einstellen auf welchen port/host er connecten soll</p>
<p>wenn ich sendto() verwende, sollte so etwas zurueck kommen:</p>
<pre><code>slackware@darkstar:~$ telnet 192.168.1.1 80
Trying 192.168.1.1...
Connected to 192.168.1.1.
Escape character is '^]'.
SEND NICK
&lt;!DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML 2.0//EN&quot;&gt;
&lt;html&gt;&lt;head&gt;
&lt;title&gt;400 Bad Request&lt;/title&gt;
&lt;/head&gt;&lt;body&gt;
&lt;h1&gt;Bad Request&lt;/h1&gt;
&lt;p&gt;Your browser sent a request that this server could not understand.&lt;br /&gt;
&lt;/p&gt;
&lt;/body&gt;&lt;/html&gt;
Connection closed by foreign host.
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/953567</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/953567</guid><dc:creator><![CDATA[Oli21]]></dc:creator><pubDate>Sat, 31 Dec 2005 16:43:03 GMT</pubDate></item><item><title><![CDATA[Reply to recv haengt? on Sat, 31 Dec 2005 16:45:54 GMT]]></title><description><![CDATA[<p>hab jetzt ein \n hingeschickt und tatsache, endlich krieg ich antwort vom apache.<br />
danke, denke jetzt komme ich wieder etwas weiter.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/953568</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/953568</guid><dc:creator><![CDATA[Oli21]]></dc:creator><pubDate>Sat, 31 Dec 2005 16:45:54 GMT</pubDate></item><item><title><![CDATA[Reply to recv haengt? on Sat, 31 Dec 2005 16:49:40 GMT]]></title><description><![CDATA[<p>Du solltest Dir mal dir RFC für HTTP durchlesen...<br />
<a href="http://www.w3.org/Protocols/rfc2616/rfc2616.html" rel="nofollow">http://www.w3.org/Protocols/rfc2616/rfc2616.html</a></p>
<p>PS: Wenn man irgendwelche Daten an einen Server schickt, heisst es noch lange nicht, dass er auch was zurückschickt... das hänght immerhin noch vom verwendeten Protokoll ab...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/953571</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/953571</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Sat, 31 Dec 2005 16:49:40 GMT</pubDate></item><item><title><![CDATA[Reply to recv haengt? on Sat, 31 Dec 2005 16:57:16 GMT]]></title><description><![CDATA[<p>Seit wann hat HTTP ein &quot;NICK&quot; Kommando? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /> <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /></p>
<p>Und sendto verwendet man für UDP und nicht für TCP.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/953576</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/953576</guid><dc:creator><![CDATA[looooool]]></dc:creator><pubDate>Sat, 31 Dec 2005 16:57:16 GMT</pubDate></item><item><title><![CDATA[Reply to recv haengt? on Sat, 31 Dec 2005 17:00:53 GMT]]></title><description><![CDATA[<p>http hat kein nick command, das hab ich zum testen verwendet<br />
und was verwende ich dann bei tcp?<br />
bitte kein flamen, danke - oder was findest du daran so lustig?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/953578</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/953578</guid><dc:creator><![CDATA[Oli21]]></dc:creator><pubDate>Sat, 31 Dec 2005 17:00:53 GMT</pubDate></item><item><title><![CDATA[Reply to recv haengt? on Sat, 31 Dec 2005 17:03:01 GMT]]></title><description><![CDATA[<p>send(...)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/953580</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/953580</guid><dc:creator><![CDATA[FireFlow]]></dc:creator><pubDate>Sat, 31 Dec 2005 17:03:01 GMT</pubDate></item><item><title><![CDATA[Reply to recv haengt? on Sat, 31 Dec 2005 17:04:58 GMT]]></title><description><![CDATA[<p>Irgendwie bist du ein Frickler.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/953582</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/953582</guid><dc:creator><![CDATA[flamer]]></dc:creator><pubDate>Sat, 31 Dec 2005 17:04:58 GMT</pubDate></item><item><title><![CDATA[Reply to recv haengt? on Sat, 31 Dec 2005 17:05:31 GMT]]></title><description><![CDATA[<p>danke fire</p>
<p>was ist ein frickler??</p>
<p>lg</p>
<p>oli</p>
]]></description><link>https://www.c-plusplus.net/forum/post/953584</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/953584</guid><dc:creator><![CDATA[Oli21]]></dc:creator><pubDate>Sat, 31 Dec 2005 17:05:31 GMT</pubDate></item><item><title><![CDATA[Reply to recv haengt? on Sat, 31 Dec 2005 17:47:26 GMT]]></title><description><![CDATA[<p>tcp != http</p>
<p>du bist ein frickler, weil du ziellost rumprobierst. nimm dir ein tutorial (beej's networking guide).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/953628</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/953628</guid><dc:creator><![CDATA[c.rackwitz]]></dc:creator><pubDate>Sat, 31 Dec 2005 17:47:26 GMT</pubDate></item><item><title><![CDATA[Reply to recv haengt? on Sat, 31 Dec 2005 17:56:19 GMT]]></title><description><![CDATA[<p>jo ich probier wild umher bevor ich poste... in der stillen hoffnung auf erfolg.<br />
hab bereits einiges gelesen ueber socket programming, und ich weiss auch das tcp nix mit http zu tun hat - trotzdem sind beides protokolle.<br />
das einzigste was ich wissen wollte ist wie ich was empfange (jetzt weiss ich ja das nichts angekommen is weil das \n gefehlt hat).<br />
und wie ich oben schon geschrieben hab, komme ich frisch von linux - da gibts eine funktion die nennt sich write(), da braucht man kein \n mitgeben; deswegen hab ich mir da auch keinen kopf drueber gemacht.<br />
trotzdem danke fuer die hilfe</p>
<p>lg</p>
<p>oli</p>
]]></description><link>https://www.c-plusplus.net/forum/post/953638</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/953638</guid><dc:creator><![CDATA[Oli21]]></dc:creator><pubDate>Sat, 31 Dec 2005 17:56:19 GMT</pubDate></item><item><title><![CDATA[Reply to recv haengt? on Sat, 31 Dec 2005 17:57:41 GMT]]></title><description><![CDATA[<blockquote>
<p>da gibts eine funktion die nennt sich write(), da braucht man kein \n mitgeben;</p>
</blockquote>
<p>So ein Quatsch.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/953639</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/953639</guid><dc:creator><![CDATA[..............]]></dc:creator><pubDate>Sat, 31 Dec 2005 17:57:41 GMT</pubDate></item><item><title><![CDATA[Reply to recv haengt? on Sat, 31 Dec 2005 18:05:09 GMT]]></title><description><![CDATA[<p>hm? was meinste mit &quot;quatsch&quot; ? das es die funktion nicht gibt? das man kein \n mitgeben muss?</p>
<p>NAME<br />
write - write to a file descriptor</p>
<p>SYNOPSIS<br />
#include &lt;unistd.h&gt;</p>
<p>ssize_t write(int fd, const void *buf, size_t count);</p>
<p>DESCRIPTION<br />
write writes up to count bytes to the file referenced by the file<br />
descriptor fd from the buffer starting at buf. POSIX requires that a<br />
read() which can be proved to occur after a write() has returned<br />
returns the new data. Note that not all file systems are POSIX con-<br />
forming.</p>
<p>ist doch auch egal jetzt, mir wurde geholfen und gut.</p>
<p>lg</p>
<p>oli</p>
]]></description><link>https://www.c-plusplus.net/forum/post/953643</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/953643</guid><dc:creator><![CDATA[Oli21]]></dc:creator><pubDate>Sat, 31 Dec 2005 18:05:09 GMT</pubDate></item><item><title><![CDATA[Reply to recv haengt? on Sat, 31 Dec 2005 18:06:42 GMT]]></title><description><![CDATA[<p>Natürlich muss man auch bei write <strong>\r</strong>\n angeben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/953644</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/953644</guid><dc:creator><![CDATA[.............]]></dc:creator><pubDate>Sat, 31 Dec 2005 18:06:42 GMT</pubDate></item></channel></rss>