Imports System.Net Imports System.Net.Sockets Imports System.Text Module Module1 Dim sock As UdpClient Dim ip As String = "127.0.0.1" Dim port As Int32 = 89 Sub Main() Try sock = New UdpClient() sock.Connect(ip, port) Do Dim bytes() As Byte = Encoding.Default.GetBytes(Console.ReadLine) sock.Send(bytes, bytes.Length) Loop Catch ex As Exception Console.Write(ex.Message) End Try End Sub End Module
Imports System.Text Imports System.IO Imports System.Net Imports System.Net.Sockets Module Module1 Dim sock As UdpClient Dim port As Int32 = 89 Dim lpendp As IPEndPoint Sub Main() Try sock = New UdpClient(port) lpendp = New IPEndPoint(0, 89) Do Dim bytes() As Byte = sock.Receive(lpendp) Console.WriteLine(Encoding.Default.GetString(bytes)) Loop Catch ex As Exception Console.WriteLine(ex.Message) End Try End Sub End Module
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)