I have a VB.NET server program running on a computer, this server program 'listens' for data sent (via TCP sockets) to it from client machines.
The code below is the VB.NET code the client machine uses to send data via TCP sockets to the 'listening' server.
My question is, is anyone able to tell me how the same could be achieved using a PHP script? - I.e. I will use my existing 'listening' VB.NET code on the server machine but I need by VB.NET code for the client translated into PHP so when the PHP script is executed it sends data to the VB.NET coded-server.
My client VB.NET code is very simple and is included below...
Imports System.Net.Sockets
Imports System.Text
Class TCPCli
Shared Sub Main()
Dim tcpClient As New System.Net.Sockets.TcpClient()
tcpClient.Connect("127.0.0.1", 8000) **** I ENTER THE IP ADDRESS HERE ****
Dim networkStream As NetworkStream = tcpClient.GetStream()
If networkStream.CanWrite And networkStream.CanRead Then
' Do a simple write.
Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes("Is anybody there") **** THIS IS THE DATA THAT IS SENT ****
networkStream.Write(sendBytes, 0, sendBytes.Length)
tcpClient.Close()
End If
End Sub
End Class