Hello,

I'm trying to get my real-time astronomy software RTGUI to send commands to the 
latest Skycharts Beta (skychart-3.0.1.6-1202-windows.exe) using the TCP/IP 
interface. This involves using Winsock on Visual Basic 6 (not .NET) as the 
TCP/IP interface. Unfortunately, Skycharts only gets as far as state 6 
(Connecting), but never reaches state 7 (connected). If you try to send or 
receive any data, you get the error message that you are not in a valid state 
for that. 

I can use Telnet from the console to connect with Skycharts, and send it 
commands. 

        telnet localhost 3292

Skycharts accepts the commands when sent in that manner.

The relevant code looks something like this. Skycharts does start up, but does 
not connect. The "loop" command at the bottom just loops forever, as the state 
never changes from "connecting" to "connected". 

    CmdLine = CielDir & "\skychart.exe"    'name of new version
    ' Now start up Skycharts, Ver 3, if installed
    rc = ShellExecute(0&, vbNullString, CmdLine, CmdLineParms,
           vbNullString, 1)  
    if (rc = OK) then     

        Set myWinSock = Form1.Winsock1
        
        
        If myWinSock.State <> sckClosed Then
            myWinSock.Close
        End If
        
        Sleep (1000)        'give Skycharts some time.
    
    
        myWinSock.Protocol = sckTCPProtocol
        myWinSock.RemoteHost = "localhost"
        myWinSock.RemotePort = 3292
    
        myWinSock.Connect
               
        Do
            DoEvents
        Loop While myWinSock.State = 6     '6 = "connecting"
    end if

Notice that I do not set up any event handlers. Is it necessary to have them in 
order to connect? I don't need to receive any data from Skycharts, just to send 
it.

       Robert Sheaffer

          

Reply via email to