Hello Gurus,
I act trying to make a Bcast System (UDP) where the server Broadcasts Data Using Timer and the client receives it, Please Check Out The Code:
' Server Codes
'---------------------
Const BROADCASTPORT = 1055
Private Sub Form_Load()
With udpBroadcast
.Protocol = sckUDPProtocol
.LocalPort = BROADCASTPORT
.RemotePort = BROADCASTPORT
.RemoteHost = "255.255.255.255"
End With
End Sub
Private Sub Timer1_Timer()
Text1.Text = "Test Bcast"
On Error GoTo ErrorHandler
Form1.udpBroadcast.SendData Text1.Text
Exit Sub
ErrorHandler:
If Err.Number <> 126 Then
MsgBox Err.Description, vbCritical, Err.Number
End If
Resume Next
End Sub
Private Sub udpBroadcast_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
MsgBox Err.Description, vbCritical, Err.Source
End Sub
'Client Code
'----------------
Const BROADCASTPORT = 1055
Private Sub Form_Load()
With udpBroadcast
.Protocol = sckUDPProtocol
.LocalPort = BROADCASTPORT
.RemotePort = BROADCASTPORT
.RemoteHost = "255.255.255.255"
End With
End Sub
Private Sub udpBroadcast_DataArrival(ByVal bytesTotal As Long)
Dim IncomingData As String
udpBroadcast.GetData IncomingData
Form1.Text3.Text = IncomingData
End Sub
The Problem is - I'm not able to get the data at client end. Can you please guide me - What is wrong with this stuff.
Vivek
Post new comment