I have looked at different versions of "Socket1" here from the forum.
But these "Socket1" do not send a text message to my PC.
Of course this is because I do not understand the procedure.
I'm looking for B4A program code that sends and receives text via the Winsock protocol (Socket1).
Thanks a lot in advance.
With this example Visual Basic (VB6) code I can send and receive text messages between 2 Windows PCs via Winsock.
But these "Socket1" do not send a text message to my PC.
Of course this is because I do not understand the procedure.
I'm looking for B4A program code that sends and receives text via the Winsock protocol (Socket1).
Thanks a lot in advance.
With this example Visual Basic (VB6) code I can send and receive text messages between 2 Windows PCs via Winsock.
B4X:
Dim ProperIP as String
ProperIP "192.168.178.1"
Private Sub InitUDP()
Dim sOwnIP As String
Dim nPort As Integer ' UDP-Port
' Set UDP protocol
Winsock1.Protocol = sckUDPProtocol
' Port to be monitored
nPort = 12345
' Determine IP
ProperIP = Winsock1.LocalIP
' Bind port to IP
Winsock1.Bind nPort, sOwnIP
End Sub
Private Sub ipAndroidSend()
' Port number at which the data is to be sent
Winsock1.RemotePort = 12345
' Name or IP of the recipient
Winsock1.RemoteHost = "192.168.178.2" ' (2) is the second computer
' send data
Winsock1.SendData "Good morning, Hello World"
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim sData As String
' The incoming data is received in a variable, (sData)...
Winsock1.GetData sData
Label1.Caption = sData
' MsgBox sData
End Sub