<?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[CSocket-Server sendet nicht &amp;quot;richtig&amp;quot;]]></title><description><![CDATA[<p>Hallo!</p>
<p>Ich habe einen CSocket-Server geschrieben, der eine Verbindung mit einem Java-Client eingeht.<br />
Die Verbindung steht, wenn der Client etwas sendet, kommt es an.<br />
Sendet der C-Server etwas kommt es nicht an.<br />
Ich habe java-seitig schon verschiedene Empfangsmöglichkeiten probiert und mache das Senden und Empfangen nun über in-/outputStreams.<br />
ganz gleiche welche Möglichkeit ich gewählt habe, java wartet auch Empfang. Das mag nun am Senden liegen.<br />
Hier etwas Code</p>
<pre><code>acceptSocket = new(CSocket);

   if (!acceptSocket-&gt;Create(5555)) 
    {
		return 1;
	}
    if (!acceptSocket-&gt;Listen()) 
	{
		return 1;
    }
	if (!acceptSocket-&gt;Accept(*refreshSocket)) // no waiting partner 
	{
		return 1;
	}

	sendData(&quot;1.nachricht&quot;,10);

	bool first = true;
	int length = 1400;
	char buff[1400];
	while(first)
	{
		if(recv(*refreshSocket, buff, length, 0))
		{
			if(buff[0] &gt;= 'a' &amp;&amp; buff[0] &lt;= 'z'){
				if(buff[0] == 'f')
				{
					AfxMessageBox(buff);
					sendData(&quot;ping&quot;,5);
					AfxMessageBox(&quot;Ping gesendet&quot;);
				}
				else
				{
					if(buff[0] == '(')
					{
						AfxMessageBox(buff);
						sendData(&quot;pong&quot;,5);
						first = false;

					}
					else
					{
						AfxMessageBox(&quot;Hu2!&quot;);

						sendData(&quot;ping&quot;,4);
						sendData(&quot;ping&quot;,4);
						sendData(&quot;ping&quot;,4);
						sendData(&quot;ping&quot;,4);
						sendData(&quot;pong&quot;,4);
						first = false;
					}
				}
			}
		}
	}

void sendData(char* buffer ,int size)
{
	refreshSocket-&gt;Send(buffer, size);
}
</code></pre>
<p>Gibt es noch andere Sendemöglichkeiten, die evtl. das Format haben, das java braucht? Bin völlig aufgeschmissen und hoffe auf Hilfe<br />
Volker</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/198495/csocket-server-sendet-nicht-quot-richtig-quot</link><generator>RSS for Node</generator><lastBuildDate>Wed, 08 Apr 2026 09:06:36 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/198495.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 22 Nov 2007 07:38:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to CSocket-Server sendet nicht &amp;quot;richtig&amp;quot; on Thu, 22 Nov 2007 07:38:27 GMT]]></title><description><![CDATA[<p>Hallo!</p>
<p>Ich habe einen CSocket-Server geschrieben, der eine Verbindung mit einem Java-Client eingeht.<br />
Die Verbindung steht, wenn der Client etwas sendet, kommt es an.<br />
Sendet der C-Server etwas kommt es nicht an.<br />
Ich habe java-seitig schon verschiedene Empfangsmöglichkeiten probiert und mache das Senden und Empfangen nun über in-/outputStreams.<br />
ganz gleiche welche Möglichkeit ich gewählt habe, java wartet auch Empfang. Das mag nun am Senden liegen.<br />
Hier etwas Code</p>
<pre><code>acceptSocket = new(CSocket);

   if (!acceptSocket-&gt;Create(5555)) 
    {
		return 1;
	}
    if (!acceptSocket-&gt;Listen()) 
	{
		return 1;
    }
	if (!acceptSocket-&gt;Accept(*refreshSocket)) // no waiting partner 
	{
		return 1;
	}

	sendData(&quot;1.nachricht&quot;,10);

	bool first = true;
	int length = 1400;
	char buff[1400];
	while(first)
	{
		if(recv(*refreshSocket, buff, length, 0))
		{
			if(buff[0] &gt;= 'a' &amp;&amp; buff[0] &lt;= 'z'){
				if(buff[0] == 'f')
				{
					AfxMessageBox(buff);
					sendData(&quot;ping&quot;,5);
					AfxMessageBox(&quot;Ping gesendet&quot;);
				}
				else
				{
					if(buff[0] == '(')
					{
						AfxMessageBox(buff);
						sendData(&quot;pong&quot;,5);
						first = false;

					}
					else
					{
						AfxMessageBox(&quot;Hu2!&quot;);

						sendData(&quot;ping&quot;,4);
						sendData(&quot;ping&quot;,4);
						sendData(&quot;ping&quot;,4);
						sendData(&quot;ping&quot;,4);
						sendData(&quot;pong&quot;,4);
						first = false;
					}
				}
			}
		}
	}

void sendData(char* buffer ,int size)
{
	refreshSocket-&gt;Send(buffer, size);
}
</code></pre>
<p>Gibt es noch andere Sendemöglichkeiten, die evtl. das Format haben, das java braucht? Bin völlig aufgeschmissen und hoffe auf Hilfe<br />
Volker</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1407909</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1407909</guid><dc:creator><![CDATA[volker7]]></dc:creator><pubDate>Thu, 22 Nov 2007 07:38:27 GMT</pubDate></item><item><title><![CDATA[Reply to CSocket-Server sendet nicht &amp;quot;richtig&amp;quot; on Thu, 22 Nov 2007 08:47:50 GMT]]></title><description><![CDATA[<p>So auf den ersten Blick fällt mir da auf, das die Länge deiner Sende-Testdaten nicht stimmt</p>
<pre><code class="language-cpp">sendData(&quot;1.nachricht&quot;,10);
</code></pre>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f4a1.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--light_bulb"
      title=":bulb:"
      alt="💡"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1407945</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1407945</guid><dc:creator><![CDATA[Cpp_Junky]]></dc:creator><pubDate>Thu, 22 Nov 2007 08:47:50 GMT</pubDate></item></channel></rss>