All pastes #910217 Raw Edit

Miscellany

public text v1 · immutable
·published 2008-02-19 20:33 UTC
rendered paste body
Dim PingPacket As Datagram
Dim SoldatPacket As Datagram
Dim s As String


UDPSocket1 - Sub DataAvailable()
  
  SoldatPacket = UDPSocket1.Read
  SoldatPacket.Address = ServerField.Text
  SoldatPacket.Port = PortField.Text.Val
  If Asc(Left(s, 1)) <> 31 Then
    UDPSocket2.Write(SoldatPacket)
  End If

UDPSocket2 - Sub DataAvailable()

  SoldatPacket = UDPSocket2.Read
  SoldatPacket.Address = "127.0.0.1"
  SoldatPacket.Port = 23073
  UDPSocket1.Write(SoldatPacket)
  s = SoldatPacket.Data
  If Asc(Left(s, 1)) = 30 Then
    PingPacket.Data = Chr(31) + Right(s,1)
    PingPacket.Address = ServerField.Text
    PingPacket.Port = PortField.Text.Val
    UDPSocket2.Write(PingPacket)
  End If

Timer1 - Sub Action()

  UDPSocket1.Poll()
  UDPSocket2.Poll()