I use the free Pc Navigator 11 version and i try to communicate with through the TCP/IP interface! I use the PC version ! Is it possible with the free version ?
I have tried to create a little vb.net script that send tcp/ip command but that don't run ! This is my code: Imports System.Net.Sockets Imports System.Net Imports System.Text
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click sendtonavigator() End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click WriteData("$destination=45.72813,8.98105;navigate\n", "127.0.0.1") End Sub
''' <summary> ''' Send data over TCP/IP network ''' </summary> ''' <param name="data">Data string to write</param> ''' <param name="IP">The connected destination TcpClient</param> Public Sub WriteData(ByVal data As String, ByRef IP As String) 'Console.WriteLine("Sending message """ & data & """ to " & IP) Dim client As TcpClient = New TcpClient() client.Connect(New IPEndPoint(IPAddress.Parse(IP), "4242")) Dim stream As NetworkStream = client.GetStream() Dim sendBytes As Byte() = Encoding.ASCII.GetBytes(data) stream.Write(sendBytes, 0, sendBytes.Length) End Sub
Public Sub sendtonavigator() Dim host As IPAddress = Nothing Dim mySock As Socket = Nothing Try If Not IPAddress.TryParse("127.0.0.1", host) Then MessageBox.Show("Adresse non valide") Exit Sub End If Dim ep As IPEndPoint = New IPEndPoint(host, Integer.Parse(4242)) mySock = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp) mySock.Connect(ep) If mySock.Connected Then mySock.Send(Encoding.ASCII.GetBytes("$destination=45.72813,8.98105;navigate\n")) 'mySock.Send(Encoding.ASCII.GetBytes("$message=""message"";ask;instant\n")) End If Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub
End Class As you can see, i have tried two differents commands that don't run ! Thanks for your help !
I am not used to Basic, but ... can you keep the connection open? Navigator accepts only one connection. Also can you wait for Navigator response? It is possible that you terminate the connection even before Navigator reads the buffers.
The run option return me: Traceback (most recent call last): File "C:\tmp\VB.NET-2010\VB.NET Pc_Navigator_TCP-IP interface\python.py", line 5, in <module> telnet = Telnet( IP, PORT ) NameError: name 'Telnet' is not defined
Ok, i worked a little beat on my issues and found to solutions, an autoit script (thanks to the french forum) and a VB.Net module. If you want to play with : Autoit script: #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_outfile=PcNavigator_cmd.exe #AutoIt3Wrapper_Compression=4 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****