Make a simple UDP chatting program
Make a simple UDP chatting program
Rate Make a simple UDP chatting program
(1(1 Vote))
'Create a winsock control name it to sckMain and change the protocol to UDP protocol
'Create 5 textboxes name them in order: txtRHost, txtRPort, txtLPort, txtOut, txtIn | in txtOut set the Locked property to True
'Create 2 commandbuttons name them in order: cmdSend, cmdConnect
Private Sub cmdConnect_click()
sckMain.RemoteHost = txtRHost 'In this textbox it shall eigther be an IP address or a freindly computer name i.e. PC1 to the computer you´re about to connect to.
sckMain.RemotePort = txtRPort 'Here shall a remote port be filled in thats the port to the computer you´re about to connect to
sckMain.Bind txtLPort 'The port you are using, the other user uses this port for remote port
End Sub
Private Sub cmdSend_click()
'Send the data thats in txtIn to the other user if it´s not empty
If txtIn <> "" Then
sckMain.SendData txtIn.text
End If
End Sub
Private Sub sckMain_Dataarrival(ByVal bytesTotal As Long)
'Shows the message from the other user in txtOut and makes a beep sound so the other user knows that he/she got a message
sckMain.GetData txtOut
Beep
End Sub
Make a simple UDP chatting program Comments
No comments yet — be the first to post one!
Post a Comment