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.

udp client erstellen

Empfohlene Antworten

Veröffentlicht

Hallo,

ich hab ein problem.... :(

ich will einen einfachen udp empfänger in VB2010 haben, der ankommende texte ausgibt. so wie unten klappt das zwar, aber der code wartet halt auf dem empfang von daten.

kann ich das irgendwie auch in ein event bringen oder so? das das programm da nicht auf den empfang wartet?

wie ginge das!?

lieben dank!

Imports System

Imports System.Net

Imports System.Net.Sockets

Imports System.Text


Public Class Form1

    Private Const listenPort As Integer = 12345


    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load


        StartListener()


    End Sub


    Public Sub StartListener()

        Dim done As Boolean = False

        Dim listener As New UdpClient(listenPort)

        Dim groupEP As New IPEndPoint(IPAddress.Any, listenPort)

        Try

            While Not done

                TextBox1.Text = "Waiting for broadcast"

                Dim bytes As Byte() = listener.Receive(groupEP)

                TextBox1.Text = TextBox1.Text & vbCrLf & "Received broadcast from {0} :" & groupEP.ToString()

                TextBox1.Text = TextBox1.Text & vbCrLf & Encoding.ASCII.GetString(bytes, 0, bytes.Length)


            End While

        Catch e As Exception

            TextBox1.Text = e.ToString()

        Finally

            listener.Close()

        End Try

    End Sub 'StartListener



End Class

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

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.