<?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[sockets]]></title><description><![CDATA[<pre><code class="language-cpp">int startWinsock()
{
  WSADATA wsa;
  return WSAStartup(MAKEWORD(2,0),&amp;wsa);
}
</code></pre>
<pre><code class="language-cpp">SOCKADDR_IN addr;
long rc;
SOCKET s;
char buf[256];   //Buffer mit 256 Bytes zum senden - muss nur senden!

rc=startWinsock();

s=socket(AF_INET,SOCK_STREAM, 0);

if(s == INVALID_SOCKET)
{
  printf(&quot;Fehler: Der Socket konnte nicht erstellt werden, fehler code: %d\n&quot;,WSAGetLastError());
}

else
{
  printf(&quot;Socket erstellt!\n&quot;);
}

memset(&amp;addr,0,sizeof(SOCKADDR_IN)); // Damit gewähren wir 0 Werte^^
addr.sin_family=AF_INET;
addr.sin_port=htons(21); // Zufallsport hat nicht irgend n Trojaner auch port 12345? hmmmm
addr.sin_addr.s_addr=inet_addr(&quot;127.0.0.1&quot;); // auf localhost^^
rc=connect(s,(SOCKADDR*)&amp;addr,sizeof(SOCKADDR));

if(rc==SOCKET_ERROR)
{
  printf(&quot;Fehler: connect gescheitert, fehler code: %d\n&quot;,WSAGetLastError());
}
else
{
  printf(&quot;Verbunden\n&quot;);
  //Wir sind verbunden und können uns nun am ftp server anmelden das geht so:
  strcpy(buf,&quot;test&quot;);  //Der Username lautet eben test das Passwort auch^^
  rc=send(s,buf,4,0);  //Wir senden 5 Zeichen rc muss auch 5 als Wert haben, wenn alles OK
  //nun zum Passwort
  rc=send(s,buf,4,0);  //Wieder 5 Zeichen
}

cin&gt;&gt;test;
FindClose(fHandle);       
}
</code></pre>
<p>So... habe also einen FTP Server lokal installiert und es gibt einen Usernamen &quot;test&quot; mit dem Passwort &quot;test&quot;. Irgendwie scheint aber der Login nicht zu funktionieren per C++ Socks... Was mach ich an diesem Script eigentlich falsch?</p>
<p>Ausgabe:<br />
Verbunden<br />
Der FTP-Server meldet auch, dass wir verbunden sind, aber irgendwie nimmt er die Username/Passwort abfrage nicht....</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/169562/sockets</link><generator>RSS for Node</generator><lastBuildDate>Wed, 15 Jul 2026 22:22:27 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/169562.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 06 Jan 2007 13:33:14 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to sockets on Sat, 06 Jan 2007 13:33:14 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">int startWinsock()
{
  WSADATA wsa;
  return WSAStartup(MAKEWORD(2,0),&amp;wsa);
}
</code></pre>
<pre><code class="language-cpp">SOCKADDR_IN addr;
long rc;
SOCKET s;
char buf[256];   //Buffer mit 256 Bytes zum senden - muss nur senden!

rc=startWinsock();

s=socket(AF_INET,SOCK_STREAM, 0);

if(s == INVALID_SOCKET)
{
  printf(&quot;Fehler: Der Socket konnte nicht erstellt werden, fehler code: %d\n&quot;,WSAGetLastError());
}

else
{
  printf(&quot;Socket erstellt!\n&quot;);
}

memset(&amp;addr,0,sizeof(SOCKADDR_IN)); // Damit gewähren wir 0 Werte^^
addr.sin_family=AF_INET;
addr.sin_port=htons(21); // Zufallsport hat nicht irgend n Trojaner auch port 12345? hmmmm
addr.sin_addr.s_addr=inet_addr(&quot;127.0.0.1&quot;); // auf localhost^^
rc=connect(s,(SOCKADDR*)&amp;addr,sizeof(SOCKADDR));

if(rc==SOCKET_ERROR)
{
  printf(&quot;Fehler: connect gescheitert, fehler code: %d\n&quot;,WSAGetLastError());
}
else
{
  printf(&quot;Verbunden\n&quot;);
  //Wir sind verbunden und können uns nun am ftp server anmelden das geht so:
  strcpy(buf,&quot;test&quot;);  //Der Username lautet eben test das Passwort auch^^
  rc=send(s,buf,4,0);  //Wir senden 5 Zeichen rc muss auch 5 als Wert haben, wenn alles OK
  //nun zum Passwort
  rc=send(s,buf,4,0);  //Wieder 5 Zeichen
}

cin&gt;&gt;test;
FindClose(fHandle);       
}
</code></pre>
<p>So... habe also einen FTP Server lokal installiert und es gibt einen Usernamen &quot;test&quot; mit dem Passwort &quot;test&quot;. Irgendwie scheint aber der Login nicht zu funktionieren per C++ Socks... Was mach ich an diesem Script eigentlich falsch?</p>
<p>Ausgabe:<br />
Verbunden<br />
Der FTP-Server meldet auch, dass wir verbunden sind, aber irgendwie nimmt er die Username/Passwort abfrage nicht....</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1204260</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1204260</guid><dc:creator><![CDATA[sockets123456]]></dc:creator><pubDate>Sat, 06 Jan 2007 13:33:14 GMT</pubDate></item><item><title><![CDATA[Reply to sockets on Sat, 06 Jan 2007 13:39:30 GMT]]></title><description><![CDATA[<p>bin gerade draufgekommen, das dass so nicht funzen kann und habe es dan nso überarbeitet aber immer noch kein erfolg</p>
<pre><code class="language-cpp">else
{
  printf(&quot;Verbunden\n&quot;);
  //Wir sind verbunden und können uns nun am ftp server anmelden das geht so:
  strcpy(buf, &quot;USER test&quot;);  //Der Username lautet eben test das Passwort auch^^
  rc=send(s,buf,10,0);  //Wir senden 5 Zeichen rc muss auch 5 als Wert haben, wenn alles OK
  if (rc != 10)
  {
     cout&lt;&lt;&quot;error&quot;;      
  }
  cout&lt;&lt;buf;
  //nun zum Passwort
  strcpy(buf, &quot;PASS test&quot;);
  rc=send(s,buf,10,0);  //Wieder 5 Zeichen
  if (rc != 10)
  {
     cout&lt;&lt;&quot;error&quot;;       
  }
  cout&lt;&lt;buf;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1204264</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1204264</guid><dc:creator><![CDATA[socket12345]]></dc:creator><pubDate>Sat, 06 Jan 2007 13:39:30 GMT</pubDate></item><item><title><![CDATA[Reply to sockets on Sat, 06 Jan 2007 13:40:31 GMT]]></title><description><![CDATA[<p>du sendest ja nur testtest an den server. das enspricht sicherlich nicht dem ft-protokoll. seit wann sind 4 zeichen 5 zeichen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1204265</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1204265</guid><dc:creator><![CDATA[testtesttest]]></dc:creator><pubDate>Sat, 06 Jan 2007 13:40:31 GMT</pubDate></item><item><title><![CDATA[Reply to sockets on Sat, 06 Jan 2007 13:42:13 GMT]]></title><description><![CDATA[<p>du musst die befehle doch auch durch einen neue zeile abtrennen sonst sieht der server doch alles als Username an</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1204266</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1204266</guid><dc:creator><![CDATA[testtesttest]]></dc:creator><pubDate>Sat, 06 Jan 2007 13:42:13 GMT</pubDate></item><item><title><![CDATA[Reply to sockets on Sat, 06 Jan 2007 13:48:42 GMT]]></title><description><![CDATA[<p>und wie trenn ich denn ab?<br />
\0<br />
\n<br />
helfen irgendwie nicht^^</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1204272</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1204272</guid><dc:creator><![CDATA[dannke]]></dc:creator><pubDate>Sat, 06 Jan 2007 13:48:42 GMT</pubDate></item><item><title><![CDATA[Reply to sockets on Sat, 06 Jan 2007 13:49:47 GMT]]></title><description><![CDATA[<p>\r\n</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1204274</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1204274</guid><dc:creator><![CDATA[testtesttest]]></dc:creator><pubDate>Sat, 06 Jan 2007 13:49:47 GMT</pubDate></item><item><title><![CDATA[Reply to sockets on Sat, 06 Jan 2007 13:51:47 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">else
{
  printf(&quot;Verbunden\n&quot;);
  //Wir sind verbunden und können uns nun am ftp server anmelden das geht so:
  strcpy(buf, &quot;USER test\r\n&quot;);  //Der Username lautet eben test das Passwort auch^^
  rc=send(s,buf,12,0);  //Wir senden 5 Zeichen rc muss auch 5 als Wert haben, wenn alles OK
  if (rc != 12)
  {
     cout&lt;&lt;&quot;error&quot;;      
  }
  cout&lt;&lt;buf;
  Sleep(1000);
  //nun zum Passwort
  strcpy(buf, &quot;PASS test\r\n&quot;);
  rc=send(s,buf,10,0);  //Wieder 5 Zeichen
  if (rc != 10)
  {
     cout&lt;&lt;&quot;error&quot;;       
  }
  cout&lt;&lt;buf;
}
</code></pre>
<p>funzt auch net^^</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1204277</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1204277</guid><dc:creator><![CDATA[neinleider]]></dc:creator><pubDate>Sat, 06 Jan 2007 13:51:47 GMT</pubDate></item><item><title><![CDATA[Reply to sockets on Sat, 06 Jan 2007 13:53:02 GMT]]></title><description><![CDATA[<p>Vllt. hilft es auch zwischendurch mal die Antworten des Servers zu lesen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>EDIT: &quot;USER test\r\n&quot; sind 11 Zeichen und bei PASS auch. und nicht 12, 5 und/oder 10 <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1204279</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1204279</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Sat, 06 Jan 2007 13:53:02 GMT</pubDate></item><item><title><![CDATA[Reply to sockets on Sat, 06 Jan 2007 14:16:31 GMT]]></title><description><![CDATA[<p>ok danke <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /><br />
jetzt läufts^^</p>
<p>noch n kleines prob^^<br />
ich will jetzt eine Datei raufspeichern das geht ja so:</p>
<blockquote>
<p>put C://test.txt test.txt</p>
</blockquote>
<p>das scheint aber nicht zu klappen^^</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1204308</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1204308</guid><dc:creator><![CDATA[jiup]]></dc:creator><pubDate>Sat, 06 Jan 2007 14:16:31 GMT</pubDate></item><item><title><![CDATA[Reply to sockets on Sat, 06 Jan 2007 14:30:58 GMT]]></title><description><![CDATA[<p>Scherzbold. Glaubste die Daten der Datei wandern von alleine durch die jeweiligen parallelen Datentunnel, wovon du nichtmal einen aufgebaut hast?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1204322</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1204322</guid><dc:creator><![CDATA[Entenwickler]]></dc:creator><pubDate>Sat, 06 Jan 2007 14:30:58 GMT</pubDate></item><item><title><![CDATA[Reply to sockets on Sat, 06 Jan 2007 14:39:03 GMT]]></title><description><![CDATA[<p>hmmm</p>
<p>wenn ich folgendes mache:<br />
ftp 127.0.0.1<br />
test<br />
test<br />
put quelle ziel</p>
<p>dann klappt es aber...<br />
was muss ich bei meinen sockets abändern dass es auch so klappt?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1204335</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1204335</guid><dc:creator><![CDATA[scherzi]]></dc:creator><pubDate>Sat, 06 Jan 2007 14:39:03 GMT</pubDate></item><item><title><![CDATA[Reply to sockets on Sat, 06 Jan 2007 14:53:19 GMT]]></title><description><![CDATA[<p>OMG biste dumm?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1204351</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1204351</guid><dc:creator><![CDATA[Entenwickler]]></dc:creator><pubDate>Sat, 06 Jan 2007 14:53:19 GMT</pubDate></item><item><title><![CDATA[Reply to sockets on Sat, 06 Jan 2007 14:57:36 GMT]]></title><description><![CDATA[<p>also hilfst du mir?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1204354</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1204354</guid><dc:creator><![CDATA[jajaaaa]]></dc:creator><pubDate>Sat, 06 Jan 2007 14:57:36 GMT</pubDate></item><item><title><![CDATA[Reply to sockets on Sat, 06 Jan 2007 14:58:33 GMT]]></title><description><![CDATA[<p>Nur für Geld.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1204355</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1204355</guid><dc:creator><![CDATA[Entenwickler]]></dc:creator><pubDate>Sat, 06 Jan 2007 14:58:33 GMT</pubDate></item><item><title><![CDATA[Reply to sockets on Sat, 06 Jan 2007 16:39:28 GMT]]></title><description><![CDATA[<p>Entenwickler schrieb:</p>
<blockquote>
<p>OMG biste dumm?</p>
</blockquote>
<p>Entenwickler schrieb:</p>
<blockquote>
<p>Nur für Geld.</p>
</blockquote>
<p>Super du hast es geschafft, dass ich 5min fuer eine Registrierung verschwende.<br />
Hinweis: Du solltest auch aufhoeren dich im wahren Leben als Frau auszugeben, das bringt dir keine Freunde!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1204437</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1204437</guid><dc:creator><![CDATA[Entenwickler]]></dc:creator><pubDate>Sat, 06 Jan 2007 16:39:28 GMT</pubDate></item><item><title><![CDATA[Reply to sockets on Sat, 06 Jan 2007 17:07:01 GMT]]></title><description><![CDATA[<p>was???? lol</p>
<p>du bist ja lächerlich weißt nicht mal wer ich bin wenn ja dann schreib doch die addresse und so weiter hier rein du n00b</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1204457</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1204457</guid><dc:creator><![CDATA[hiho]]></dc:creator><pubDate>Sat, 06 Jan 2007 17:07:01 GMT</pubDate></item><item><title><![CDATA[Reply to sockets on Sat, 06 Jan 2007 18:34:35 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/profile.php?mode=viewprofile&amp;u=10455" rel="nofollow">evilissimo</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/viewforum.php?f=15" rel="nofollow">C++</a> in das Forum <a href="http://www.c-plusplus.net/forum/viewforum.php?f=4" rel="nofollow">WinAPI</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic.php?t=39405" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1204570</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1204570</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Sat, 06 Jan 2007 18:34:35 GMT</pubDate></item><item><title><![CDATA[Reply to sockets on Sat, 06 Jan 2007 21:24:01 GMT]]></title><description><![CDATA[<p>weiß net wie ich dir helfen könnte^^</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1204682</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1204682</guid><dc:creator><![CDATA[hmmads]]></dc:creator><pubDate>Sat, 06 Jan 2007 21:24:01 GMT</pubDate></item></channel></rss>