Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Hi Leute, nochmal ich!

Ich habe mittlerweile mein erstes Problem (ebenfalls hier im Forum zu lesen) bewältigt und versuche nun verzweifelt rauszufinden, wie ich nach einem "accept", also wenn die verbindung steht, die IP Adresse und die Daten die er oder ich senden rauszubekommen.

meinen Code an der Stelle wo ich die Die Dten auslesen möchte poste ich mal hier!


   for(int i = 0; i<=this->portanz; i++)

   {

      this->s = WSASocket(AF_INET, SOCK_STREAM, IPPROTO_TCP, 0, 0, 0);

      pSa.sin_port = htons(i);


      if(bind(this->s,(sockaddr*)&pSa, sizeof(pSa)) != SOCKET_ERROR)

      {

         Form1->ListBox1->Items->Add("Verbinde zu Port:" + (AnsiString)i);


         if(listen(this->s, SOMAXCONN) != SOCKET_ERROR)

         {

            Form1->ListBox1->Items->Add("Lausche an Port:" + (AnsiString)i);


            if(accept(this->s, (sockaddr*)&pSa, (int*)sizeof(pSa)) != INVALID_SOCKET)

            {

               Form1->ListBox1->Items->Add("Verbindung hergestellt zu Port: " + (AnsiString)i);

            }

            else if(accept(this->s, (sockaddr*)&pSa, (int*)sizeof(pSa)) == INVALID_SOCKET)

            {

               Form1->ListBox1->Items->Add((AnsiString)WSAGetLastError());

            }

         }

         else

         {

            Form1->ListBox1->Items->Add((AnsiString)WSAGetLastError());

         }

      }

      else

      {

         Form1->ListBox1->Items->Add((AnsiString)WSAGetLastError());

      }


      shutdown(this->s, SD_BOTH);

      Form1->ListBox1->Items->Add("Geschlossen");

   }




			

			
		
Originally posted by PuppetMaster

Ich habe mittlerweile mein erstes Problem (ebenfalls hier im Forum zu lesen) bewältigt und versuche nun verzweifelt rauszufinden, wie ich nach einem "accept", also wenn die verbindung steht, die IP Adresse und die Daten die er oder ich senden rauszubekommen.

Nach dem Aufruf von accept steht die IP-Adresse des Rechners, der die Verbindung aufgebaut hat, in der Struktur, deren Adresse du als zweiten Parameter übergeben hast. Was der andere Rechner sendet, erfährst du, indem du es empfängst (recv). Was du sendest, solltest du selbst wissen. ;)

(int*)sizeof(pSa)
Das müsste dir eigentlich um die Ohren fliegen.

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.