' Collection of code snippets by Arne Vajhøj 
' (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
Imports System
Imports System.IO
Imports System.Net
Imports System.Net.Sockets
Imports System.Runtime.Serialization.Formatters.Binary

Public Class Server
    Public Shared Sub Main(args As String())
        Dim server As New TcpListener(IPAddress.Any, 12345)
        server.Start()
        Dim client As TcpClient = server.AcceptTcpClient()
        Dim binser As BinaryFormatter = New BinaryFormatter()
        Dim o As T1 = CType(binser.Deserialize(client.GetStream()), T1)
        client.Close()
        server.Stop()
        Console.WriteLine(o.F1 & " " & o.F2)
    End Sub
End Class
