Nate Bross
Contributor
I am trying to have my PocketPC send data to a DesktopPC. I am using sockets, if I run the binary file for the PocketPC on the desktop I am able to connect and lifes good. When I run the binary on the PocketPC I recieve the following error: 'No such host is known.' The server I am trying to connect to is also a running a webserver, on the PocketPC I am able to view webcontent from the server. This is the code throwing the error.
The variables hostname, and port are passed to the sub.
Visual Basic.NET is preferable; however C# Code is okay I can attempt to convert.
Visual Basic:
objTCPClient = New TcpClient
objTCPClient.Connect(hostname, port)
'ClientThread = New Thread(AddressOf ConnectionRequest)
'ClientThread.Start()
' Get the stream
Dim networkStream As NetworkStream = objTCPClient.GetStream()
Do Until False
' Read the stream into a byte array
Dim bytes(objTCPClient.ReceiveBufferSize) As Byte
networkStream.Read(bytes, 0, CInt(objTCPClient.ReceiveBufferSize))
' Return the data received from the client to the console.
Dim ClientData As String = Encoding.UTF8.GetString(bytes, 0, bytes.Length)
Call OwningForm.DebugText(("<Server> " & ClientData))
'Dim responseString As String = "Recieved."
'Dim sendBytes As [Byte]() = Encoding.UTF8.GetBytes(responseString)
'networkStream.Write(sendBytes, 0, sendBytes.Length)
'Call OwningForm.DebugText(("Server Sent> " & responseString))
Application.DoEvents()
Loop
Visual Basic.NET is preferable; however C# Code is okay I can attempt to convert.