Hey all,
I hope this is the right thread.
I am working on an application which will run on windows ce 6.0.
It will receive data on serial port, and store it to a cf card plus forward it to network.
Now I have never done anything with network so I am a total rookie, but I searched internet and forums and found this article Client Server Multithreading Application
which I modified to what I need.
At my client side(application on device) I have this part of code:
Well the problem is that stm.write hangs. Would anyone know why.
Is there a better way to achive this, I only need to forward data to a server. For now server won't send anything to client.
Thanks for help.
Greg
I hope this is the right thread.
I am working on an application which will run on windows ce 6.0.
It will receive data on serial port, and store it to a cf card plus forward it to network.
Now I have never done anything with network so I am a total rookie, but I searched internet and forums and found this article Client Server Multithreading Application
which I modified to what I need.
At my client side(application on device) I have this part of code:
VB.NET:
Dim trdNetConnect As Thread
Dim trdNetConnectIsRunning As Boolean = False
Dim ipAddress As String = "192.168.45.20"
Dim portNumber As Integer = 8002
Public Sub startServer()
trdNetConnectIsRunning = True
tcpclnt = New TcpClient()
Do
Try
tcpclnt.Connect(ipAddress.Trim(), portNumber)
stm = tcpclnt.GetStream()
eth_conn = True
trdNetConnectIsRunning = False
Exit Do
Catch ex As Exception
eth_conn = False
End Try
Thread.Sleep(1000)
Loop
End Sub 'startServer
Public Sub writeToServer(ByVal strn As String)
Dim encord As New System.Text.ASCIIEncoding()
Dim state As New StateObj
writeBuffer = encord.GetBytes(strn)
If Not (stm Is Nothing) Then
Try
_Frm_Main.UpdateTextBox1("write")
'stm.BeginWrite(writeBuffer, 0, writeBuffer.Length, New AsyncCallback(AddressOf ), state)
stm.Write(writeBuffer, 0, writeBuffer.Length)
_Frm_Main.UpdateTextBox1("write out")
Catch ex As Exception
eth_conn = False
End Try
End If
End Sub 'writeToServer
Well the problem is that stm.write hangs. Would anyone know why.
Is there a better way to achive this, I only need to forward data to a server. For now server won't send anything to client.
Thanks for help.
Greg