Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

 

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

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.

~Nate�

___________________________________________

Please use the [vb]/[cs] tags on posted code.

Please post solutions you find somewhere else.

Follow me on Twitter here.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...