I don't know basic4android, but a simple VB6 project for on the computer can be as follows :
'1 form with :
' 1 textbox : name=Text1
' 1 winsock control : name=Winsock1
Option Explicit
Private Sub Form_Load()
Text1.Move 0, 0, ScaleWidth, ScaleHeight 'position the textbox
With Winsock1
.LocalPort = 5001 'set the port to listen on
.Listen 'start listening
End With 'Winsock1
End Sub
Private Sub Winsock1_ConnectionRequest(ByVal requestID As Long)
With Winsock1
If .State <> sckClosed Then .Close 'close the port when not closed (you could also use another winsock control to accept the connection)
.Accept requestID 'accept the connection request
End With 'Winsock1
End Sub
Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim strData As String
Winsock1.GetData strData 'get the data
ProcessData strData 'process the data
End Sub
Private Sub Winsock1_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 Description, vbCritical, "Error " & CStr(Number)
End Sub
Private Sub ProcessData(strData As String)
Text1.SelText = strData 'show the data
End Sub
Some remarks :
This project uses the listening winsock control to accept the connection, so after that you are not listening to new connection requests anymore.
When you plan on sending large chunks of data you should probably buffer the data, and process it when it's complete.