Imports System.Net.Sockets
Imports System.Text
Imports System.IO
Imports System.Net
Public Class Tester
Public Shared Sub Main
Try
Dim bteDataAccept() As Byte
Dim strdataAccept As String = ""
Dim myEndPoint As New IPEndPoint(IPAddress.Parse("127.0.0.1"), 12345)
Dim myByte(36000) As Byte
Dim myUdpClient As UdpClient = New UdpClient(12345)
myByte = myUdpClient.Receive(Nothing)
Dim myFileStream As FileStream = New FileStream("test.txt", FileMode.Create, FileAccess
.Write)
myFileStream.Write(myByte, 0, myByte.Length)
myFileStream.Close()
myUdpClient.Close()
Catch e As Exception
Console.WriteLine(e.ToString )
End Try
End Sub
End Class
|