Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

No response from Winsock.Getdata

Posted on 2008-06-25
24
Medium Priority
?
1,208 Views
Last Modified: 2012-06-22
Never receive data from Winsock.GetData, see code snippet below. It sits in an endless While Loop waiting for the response. Any suggestions on how to resolve.
Thanks

      Winsock.SendData szSendBuffer & Chr(10)
       szReceiveBuffer= ""
     
        Do While szReceiveBuffer= ""
          Winsock.GetData szReceiveBuffer, vbString, 500
          Sleep 1000
        Loop
       
       
0
Comment
Question by:Mark_H6
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 13
  • 11
24 Comments
 
LVL 11

Expert Comment

by:melmers
ID: 21873352
If you are using the winsock control, you must use the DataArrival Event from the Winsock control to
get the data. If you are writing a client/server application both must implement the DataArrival Event and the Server must call the Listen Function to go into a listening modus.
Private Sub TcpClient_DataArrival(ByVal bytesTotal As Long)
Dim s$ 'Your recived Data
TcpClient.GetData s 
 
End Sub

Open in new window

0
 

Author Comment

by:Mark_H6
ID: 21873411
I don't see a method in the WinSock object used to trap that event. Can you provide an example on how to accomplish. I am using VB 6.0
Thanks
0
 
LVL 11

Expert Comment

by:melmers
ID: 21873430
Declare the Winsock Object with the option WithEvents as an global object in your form.

Can you post me your code ?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Mark_H6
ID: 21873501
Not sure how to accomplish. Code attached. See subroutine Sub Cmd_Process_manual_Click. This is a program used to test the API of a Client/Server program.
Const swSTART As Boolean = True
Const swSTOP  As Boolean = False
Dim File As String
Dim Socket_ip_file As String
Dim Socket_Response_Error_file As String
Dim Socket_Summary_file As String
 
 
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
 
 
 
 
Dim strData As String ' string for received data
 
Private Sub CheckBox_Record_Click()
On Error Resume Next
 
If CheckBox_Record.Value = True Then
    
    Add_Comment.Visible = True
    Manual_Filelocation = InputBox("Enter the location and file name to create")
            
   If Manual_Filelocation = "" Then
        MsgBox ("Please enter the file name and location  to store manual transactions")
        CheckBox_Record.Value = False
   Else
           
    If RFsys_Man.FileExists(Manual_Filelocation) Then
       Set RFObj_man = RFsys_Man.OpenTextFile(Manual_Filelocation, ForAppending)
    Else
       Set RFObj_man = RFsys_Man.CreateTextFile(Manual_Filelocation, True)
    End If
    
    If Err.Number = 5 Then
       MsgBox ("File already exist, enter a new file name")
       CheckBox_Record.Value = False
    Else
       If Err.Number = 0 Then
        MsgBox ("File Created Successfully")
       Else
            MsgBox ("Please enter a valid file name and location")
            CheckBox_Record.Value = False
        End If
    End If
            
  End If
 
Else
    Add_Comment.Visible = False
End If
 
End Sub
Private Sub Add_Comment_Click()
 Transaction_Comment = ""
 Transaction_Comment = InputBox("Enter the Comment for transaction")
End Sub
 
Private Sub Cmd_AS400_Click()
    sock.Close
    TxtRitaIP.Enabled = True
    TxtRitaPort.Enabled = True
    TxtRitaIP.Text = "10.64.80.41"
    TxtRitaPort.Text = "5012"
End Sub
 
Private Sub Cmd_Local_Click()
    sock.Close
    TxtRitaIP.Enabled = True
    TxtRitaPort.Enabled = True
    TxtRitaIP.Text = "127.0.0.1"
    TxtRitaPort.Text = "5012"
End Sub
 
Private Sub CmdRitaConnect_Click()
  
  Socket_ip_file = " "
  
  If sock.State = sckClosed Then ' if the socket is closed
    TxtRitaIP.Enabled = False
    TxtRitaPort.Enabled = False
    sock.RemoteHost = TxtRitaIP.Text ' set server adress
    sock.RemotePort = TxtRitaPort.Text ' set server port
    sock.Connect ' start connection attempt
    Man_Flag = False
  Else ' if the socket is open
    sock.Close ' close it
  End If
 
End Sub
 
Private Sub Cmd_Browse_Click()
 
If sock.State = sckClosed Then
    MsgBox ("Connect to Rita before staring the process")
Else
    Process_string = "Result_file"
    Error_string = "Error_File"
    Summary_string = "Summary_File"
    Testcase_string = "TestCase No :"
    
    With CommonDialog1
        .CancelError = False
        .DialogTitle = "Browse for input files "
        .Filter = "Text files|*.txt|All files|*.*"
        .FilterIndex = 1
        .flags = cdlOFNExplorer Or cdlOFNFileMustExist
        .ShowOpen
        If .FileName <> "" Then TxtInputFile1.Text = .FileName
    End With
  
    Path_name = TxtInputFile1
    search_char = "\"
    found_pos = InStrRev(Path_name, search_char, -1, 1)
    Final_string = Mid(Path_name, 1, found_pos)
    New_Final_string = Final_string & Process_string
    New_Error_string = Final_string & Error_string
    New_Summary_string = Final_string & Summary_string
    TxtProcessfile.Text = New_Final_string
    
    Filename1 = TxtInputFile1.Text
    File = TxtProcessfile.Text
    
    Cur_date = Date
    Cur_time = Time
    New_date = Format(Cur_date, "mmddyy")
    New_time = Format(Cur_time, "hhmmss")
    ext = ".txt"
    underscore = "_"
    ext_time = 0
    
    File = File & New_date & underscore & New_time & ext
    Socket_ip_file = Filename1
    Socket_Response_Error_file = New_Error_string & New_date & underscore & New_time & ext
    Socket_Summary_file = New_Summary_string & New_date & underscore & New_time & ext
End If
End Sub
 
Private Sub CmdRitaDisconnect_Click()
  TxtRitaIP.Enabled = True
  TxtRitaPort.Enabled = True
  sock.Close
End Sub
 
Private Sub Cmd_Auto_Process_Click()
 
If sock.State = sckClosed Then  ' CONNECT TO RITA IF
   MsgBox ("Connect to Rita before sending transactions")
Else
 
If Socket_ip_file = " " Then
   MsgBox ("Browse and Select the input file to be processed")
Else
 
    
             
    Dim iTimer As Long  ' number of milliseconds
    Call StopWatch(swSTART)
         
         
    'Dim t As TClock
    'Set t = Clock("Execute RITA I/P Transactions")
    ext_time = 0
 
    't.Start
    
    
    
    On Error Resume Next
    
    CRLF = Chr(13) & Chr(10)
    CR = Chr(13)
    LF = Chr(10)
   
    ' Call Subroutines starts here
        GoSub Open_File
        GoSub Socket_Input_File_Processing
    ' Call Subroutine ends here
 
     TxtReceiveData.Text = ""
    ' sock.SendData StrRECbuffer & Chr(10)
     TxtSendData.Enabled = True
 
'********************************************************************
'Subroutines Attached here
'********************************************************************
 
'File Open Subroutine Starts Here
 
Open_File:
 
Socket_response_file = File
 
 
 'If Soc_RFsys.FileExists(Socket_response_file) Then
 '   Set Soc_RFObj = Soc_RFsys.OpenTextFile(FileName_inp, ForAppending)
 'Else
 '   Set Soc_RFObj = Soc_RFsys.CreateTextFile(Socket_response_file, True)
 'End If
 
Set Soc_RFObj = Soc_RFsys.CreateTextFile(Socket_response_file, True)
 
 
 
  If Soc_Err_RFsys.FileExists(Socket_Response_Error_file) Then
    Set Soc_Err_RFObj = Soc_Err_RFsys.OpenTextFile(Socket_Response_Error_file, ForAppending)
 Else
    Set Soc_Err_RFObj = Soc_Err_RFsys.CreateTextFile(Socket_Response_Error_file, True)
 End If
 
 
 If Soc_Sum_RFsys.FileExists(Socket_Summary_file) Then
    Set Soc_Sum_RFObj = Soc_Sum_RFsys.OpenTextFile(Socket_Summary_file, ForAppending)
 Else
    Set Soc_Sum_RFObj = Soc_Sum_RFsys.CreateTextFile(Socket_Summary_file, True)
 End If
 
 ' Open Socket Input File
 
  Open Socket_ip_file For Input As 1
 
  Return ' Return to calling module - Open_File
 
'File Open Subroutine Ends Here
 
'Porgram processing starts here
 
Socket_Input_File_Processing:
 
On Error Resume Next
 
CRLF = Chr(13) & Chr(10)
CR = Chr(13)
LF = Chr(10)
 
szFollowOnTransaction = "FALSE"
 
Dim TextPanelBuffer As String
Dim strFLDbuffer
 
Irec1 = 0
tot_inp_rec = 0
Tot_Err_count = 0
 
'Open Socket_ip_file For Input As 1
 
  Do While Not EOF(1)      ' Loop until end of file.
       
      BuildRecFlag = "TRUE"
       
      strStartTRANS = "FALSE"
      StrRECbuffer = ""
      strData = ""
       
       Do While BuildRecFlag = "TRUE"
          Input #1, fField
         
         '//Identified Start of TRANSACTION
         
          If EOF(1) = True Then
             Exit Do
          End If
         
         If InStr(fField, "FUNCTION_TYPE") <> 0 Then
            strStartTRANS = "TRUE"
         End If
         
         If InStr(fField, "//") = 0 And fField <> "" Then '//Start-IF005
              
          '//Start of Transactions
          
          If InStr(strStartTRANS, "TRUE") <> 0 Then '//Start-IF004
             If InStr(fField, "..") = 0 Then '//Start-IF003
                 StrRECbuffer = StrRECbuffer & Chr(10) & fField
              End If '//END-IF003
          End If '//END-IF004
               
          If InStr(fField, "..") <> 0 Then
            Exit Do
           End If
               
         End If '//Start-IF005
                 
       Loop
       
    If EOF(1) = True Then
       Exit Do
    End If
       tot_inp_rec = tot_inp_rec + 1
       
       TxtProcrec.Text = tot_inp_rec
       
       testcase_num = tot_inp_rec
       
        
' Follow-on Transaction Logic Starts Here
    
'Step 1: Find the transaction command in the RITA input tranasction logic Starts here
    
    command_search_word = "COMMAND"
    
    Word_position = InStr(1, StrRECbuffer, command_search_word, vbTextCompare)
        
      T_I = 1
      t_c = ""
      
     command_string = " "
      
    Word_position = Word_position + 7
    
    If Word_position > 0 Then
        
        Do While t_c <> Chr(10)
    
            t_c = Mid(StrRECbuffer, Word_position + T_I, 1)
            
            If t_c <> Chr(10) Then
                     
               command_string = command_string & t_c
               T_I = T_I + 1
            
            End If
         Loop
    End If
         
  ' Find the command in the RITA input tranasction logic Ends here
 
 ' Check tansaction type
         
        If InStr(command_string, "VOID") <> 0 Or _
            InStr(command_string, "COMMERCIAL") <> 0 Or _
            InStr(command_string, "ADD_TIP") <> 0 Or _
            InStr(command_string, "COMPLETION") <> 0 Or _
            InStr(command_string, "REVERSAL") <> 0 Or _
            InStr(command_string, "RESET_TIP") <> 0 Then
            szFollowOnTransaction = "TRUE"
        Else
            szFollowOnTransaction = "FALSE"
            Newstring = " "
        End If
               
               
        '// Append strTROUTD to String if FollowOn
        
         If (iValue = InStr(szFollowOnTransaction, "TRUE")) = 0 Then '//Start-IF001
            BufferLen = Len(StrRECbuffer) - 2
            StrRECbuffer = Left(StrRECbuffer, BufferLen) 'Remove single dot
            StrRECbuffer = StrRECbuffer & Chr(10) & strTROUTD & Chr(10) & "." & Chr(10)
         Else
            BufferLen = Len(StrRECbuffer) - 2
            StrRECbuffer = Left(StrRECbuffer, BufferLen) 'Remove single dot
            StrRECbuffer = StrRECbuffer & Chr(10) & "." & Chr(10)
         End If '//End-IF001
   
    ' Follow-on Transaction Logic Ends Here
        
    ' SEND DATA to the socket Starts Here
       
     sock.SendData StrRECbuffer & Chr(10)
     TxtSendData.Text = StrRECbuffer
     
     'Write request into file
     
        Soc_RFObj.WriteLine ("============================================================================================")
        Soc_RFObj.WriteLine
        Soc_RFObj.WriteLine "Record Number:" & tot_inp_rec
        
        Soc_RFObj.WriteLine ("REQUEST to RITA >>>>>")
        Soc_RFObj.WriteLine ("-------------------")
       ' Sleep (1)
        Soc_RFObj.Write StrRECbuffer
        Soc_RFObj.WriteLine CRLF & CRLF
                    
        
    ' Send Data to the socket Ends Here
       
    'RECEIVE DATA Logic Starts Here
       strData = ""
       TxtReceiveData.Text = ""
        
        Do While strData = ""
          Sleep 1000
          sock.GetData strData
          If strData = "" Then
             Sleep 1000
          End If
        Loop
        
        TxtReceiveData.Text = ""
             
         Do While TxtReceiveData.Text = ""
              TxtReceiveData.Text = strData
         Loop
        
        socket_recieved_data = strData
                
        myresponse = socket_recieved_data
           
    'RECEIVE DATA Logic Ends Here
    
    'Write response into the file Starts here
    
    Myresponse_length = Len(myresponse)
    
    If Myresponse_length = 0 Then
       myresponse = strData
    End If
    
  If Myresponse_length > 0 Then ' Check whether myresponse has value in it
  
  'Write response into file
        
        Soc_RFObj.WriteLine ("Response from RITA <<<<<<")
        Soc_RFObj.WriteLine ("-------------------")
        Sleep 1000
        Soc_RFObj.WriteLine myresponse
       
   ' Write response into the file ends here
    
     ' Rita String Manipulation Logic Starts Here
        
       search_string = myresponse
        search_word = "TROUTD"
       
         mypos1 = 0
         mypos1 = InStr(1, search_string, search_word, vbTextCompare)
      
        I = 0
        C = ""
    
    If mypos1 > 0 Then
        
       'Troutd logic
                
       Do While C <> Chr(13)
            C = Mid(search_string, mypos1 + I, 1)
            If C <> Chr(13) Then
               Tempstring = Tempstring & C
               I = I + 1
            End If
       Loop
       
        Newstring = Tempstring
        Tempstring = ""
     
   End If ' mypos1 check end if
        
    strTROUTD = Newstring
 
    ' String Manipulation Logic Ends Here
 
     ' Find Error Transaction logic
 
    result_search_word = "RESULT"
    result_position = InStr(1, search_string, result_search_word, vbTextCompare)
        
      T_I = 1
      t_c = ""
      result_string_1 = " "
     command_string_1 = " "
     
    result_position = result_position + 6
    
    If result_position > 0 Then
        
        Do While t_c <> Chr(13)
             t_c = Mid(search_string, result_position + T_I, 1)
             If t_c <> Chr(13) Then
                result_string_1 = result_string_1 & t_c
                T_I = T_I + 1
             End If
         Loop
    End If ' result position check end if
       
    ' Write into error file here
    
    If result_string_1 = " ERROR" Or _
      result_string_1 = " DECLINED" Then
    
        'UserCheck "Test result details", False, "Test Case :" & testcase_num & " ==>Failed"
        'TestLog.Comment (Testcase_string & testcase_num & "Failed")
    
        Tot_Err_count = Tot_Err_count + 1
       
        Soc_Err_RFObj.WriteLine ("=============================================================================================")
        Soc_Err_RFObj.WriteLine
        Soc_Err_RFObj.WriteLine "Input File Recount Number:" & tot_inp_rec
        Soc_Err_RFObj.WriteLine "Error count              :" & Tot_Err_count
        Soc_Err_RFObj.WriteLine ("REQUEST to RITA >>>>>")
        Soc_Err_RFObj.WriteLine ("-------------------")
       
        Soc_Err_RFObj.Write StrRECbuffer
        Soc_Err_RFObj.WriteLine CRLF & CRLF
        Soc_Err_RFObj.WriteLine ("Response from RITA <<<<<<")
        Soc_Err_RFObj.WriteLine ("-------------------")
        Soc_Err_RFObj.WriteLine search_string
    End If
    
    'Else
    '    UserCheck "Test result details", True, "Test Case :" & testcase_num & " ==>Passed"
    '    TestLog.Comment (Testcase_string & testcase_num & "Passed")
    'End If    ' - result string check end if
           
   End If  ' Myresponse not equal to space end if
   
    act_time = t.Elapsed
    act_time = act_time / 1000
    ext_time = act_time / 60
   
    TxtProcTime.Text = ext_time
    
    sock.Connect
    'UserCheck "  ", True, " "
    'UserCheck "  ", True, " "
 Loop ' - Main loop
    
  ' Time Calculation
     
     'act_time = t.Elapsed
     act_time = StopWatch(swSTOP)
     act_time = act_time / 1000
     't.Stop
     StopWatch (swSTART)
     
     act_time = act_time / 60
     
    MsgBox ("End Of File Reached and Process Completed" & "Test run Time " & act_time & "minutes")
        
    ' Write into Summary File
    
    No_of_transactions_passed = tot_inp_rec - Tot_Err_count
    
    Soc_Sum_RFObj.WriteLine ("Date  :" & Cur_date & "                   Time:" & Cur_time)
    Soc_Sum_RFObj.WriteLine ("=============================================================================================")
    Soc_Sum_RFObj.WriteLine ("No. of Transactions Processed   :" & tot_inp_rec)
    Soc_Sum_RFObj.WriteLine ("No. of Transactions Passed      :" & No_of_transactions_passed)
    Soc_Sum_RFObj.WriteLine ("No. of Transactions Errored     :" & Tot_Err_count)
    Soc_Sum_RFObj.WriteLine ("Total Time Taken for Processing :" & act_time)
    Soc_Sum_RFObj.WriteLine ("=============================================================================================")
    
    Close #1
    
End If ' File exist check IF
 
''''Socket Logic Subroutine Ends Here '''''''''''''''''
 
End If 'CONNECT TO RITA IF
 
Test_Run = "True"
 
' Send Email
 
'If Test_Run = "True" Then
'    If Check_Send_Email.Value = True Then
'        Run "Send_email"
'    End If
'End If
 
End Sub
 
Private Sub Cmd_Process_manual_Click()
  TextLength = Len(RTrim(TxtSendData.Text))
 '  MsgBox (TextLength)
   
If TxtSendData.Text = "" Or TxtSendData.Text = " " Or Len(RTrim(TxtSendData.Text)) < 0 Then
    MsgBox ("Enter transactions to process")
Else
 
If sock.State = sckClosed Then
          MsgBox ("Connect to RITA before sending transactions")
Else
 If TextLength > 0 Then
       
       manual_processing = True
       
       TxtReceiveData.Text = " "
            
       sock.SendData TxtSendData.Text & Chr(10)
              
             
        strData = ""
        TxtReceiveData.Text = ""
        
      
   
        Do While strData = ""
          sock.GetData strData, vbString, 500
          Sleep 1000
        Loop
       
       
       TxtReceiveData.Text = strData
         
       If CheckBox_Record.Value = True Then
        X_String = ".."
        Rec_string = TxtSendData.Text
        RFObj_man.WriteLine
        RFObj_man.WriteLine "//" & Transaction_Comment
        RFObj_man.WriteLine
        RFObj_man.WriteLine Rec_string
        RFObj_man.WriteLine X_String
        RFObj_man.WriteLine
               
    'Write Logic for commenting the response with "//" starts here
        
        R_C = " "
        Resp_Chr_Cnt = 0
 
        Response_string = TxtReceiveData.Text
        Resp_string_length = Len(Response_string)
        Response_string_1 = "///"
        flag_1 = False
        
        Do While Resp_string_length <> 0
        
           R_C = Mid(Response_string, 1 + Resp_Chr_Cnt, 1)
           
             If R_C <> Chr(13) Then
               Response_string_1 = Response_string_1 & R_C
             Else
              Response_string_1 = Response_string_1 & R_C & "//"
              Resp_Chr_Cnt = Resp_Chr_Cnt + 1
             End If
             
             Resp_Chr_Cnt = Resp_Chr_Cnt + 1
             Resp_string_length = Resp_string_length - 1
        Loop
        
     'Write Logic for commenting the response with "//" ends here
        
       RFObj_man.WriteLine Response_string_1
       End If
End If
End If
End If
End Sub
Private Sub Cmd_Stop_Recording_Click()
If Manual_Filelocation <> "" Then
    MsgBox ("Recording Stopped")
    RFObj_man.Close
End If
 
End Sub
 
Private Sub Label10_Click()
 
End Sub
 
Private Sub sock_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
  'MsgBox "Socket Error " & Number & ": " & Description
  TxtRitaIP.Enabled = True
  TxtRitaPort.Enabled = True
  MsgBox ("RITA is not running, please start RITA before connecting")
                                   ' show some "debug" info
    
  sock.Close ' close the erraneous connection
End Sub
 
Private Sub sock_Close()
  sock.Close ' has to be called
End Sub
 
Private Sub Cmd_Clear_Click()
TxtReceiveData.Text = " "
TxtSendData.Text = " "
full_string = " "
TxtInputFile1.Text = " "
TxtProcessfile.Text = " "
TxtProcrec.Text = " "
TxtProcTime.Text = " "
End Sub
 
Private Sub Cmd_Stop_Click()
Stop
End Sub
 
Private Sub Cmd_Close_Click()
sock.Close
Socket_Client_Form_New.Hide
End Sub
 
Private Sub UserForm_Click()
 
End Sub
 
'=====================================================
Public Function StopWatch(bStart As Boolean) As Long
'
' returns number of milliseconds since the operating system was started
'
' your project should use:
'    Const swSTART as Boolean = True
'    Const swSTOP  as Boolean = False
'
' If "swSTART" is sent as the parameter, the timer is reset to zero.
' If "swSTOP"  is sent, the total time since the last "swSTART" is returned.
' Time continues to accumulate until "swSTART" is sent again.
'
 Static iOld As Long
 Dim iNew As Long
  iNew = timeGetTime
  StopWatch = iNew - iOld
  If bStart Then
   StopWatch = 0
   iOld = iNew
  End If
End Function

Open in new window

0
 
LVL 11

Expert Comment

by:melmers
ID: 21873547
Where did you declare the sock object ?
Is this the sock Object an component what you have included on your form?

does the Sub Cmd_Auto_Process_Click() work ?
0
 

Author Comment

by:Mark_H6
ID: 21873592
Yes sock object is a WinSock control on the form. Sub Cmd_Process_manual_Click send the data, but hangs in the while loop looking for the response.
0
 
LVL 11

Expert Comment

by:melmers
ID: 21873684
please try to change the code from
 Do While strData = ""
          sock.GetData strData, vbString, 500
          Sleep 1000
Loop

to:
 Do While strData = ""
          sock.GetData strData
          Sleep 1000
Loop

0
 

Author Comment

by:Mark_H6
ID: 21873728
Made change get same same results, still hangs in the loop waiting for response. When I am in debug mode I set a watch on the sock object and verified that the connection state is 7, which I believe indicates it is connected.
0
 
LVL 11

Expert Comment

by:melmers
ID: 21873847
yes state 7 is connected. Could it be that your server don't response to your data you send ?
Because in the Cmd_Auto_Process_Click()  Sub the end of the message is chr(10) & "." & chr(10) & chr(10) see line 345 - 353 of your code you send only Text &  chr(10)
0
 

Author Comment

by:Mark_H6
ID: 21874080
It should, this same code works in a VB script environment, however, when it was ported over to VB6 to create a standalone application the problem with the GetData issue was identified.
0
 
LVL 11

Expert Comment

by:melmers
ID: 21874215
i think the code is right, check your input or debug the Cmd_Auto_Process_Click get a send string which works and put it into your cmd_Manual code to test that you send the right data.

Get some tools to monitor the networktraffic like wireshark. With wireshark you can see what happens on your networkcard and if the server response to your data then you would see it with wireshark. If the server  sends no response your input is wrong.

http://www.wireshark.org/
0
 

Author Comment

by:Mark_H6
ID: 21874231
Thanks! I will give that a try. I will let you know the results shortly.
0
 

Author Comment

by:Mark_H6
ID: 21883251
As you suggested I used wireshark to monitor the TCP/IP activity between the client and server, found out that the application is not getting initially connected, see lines 75-88; function CmdRitaConnect_Click. The RemoteHost and ReportPort are valid. Is there anything else I need to set before connecting?
Thanks
0
 
LVL 11

Expert Comment

by:melmers
ID: 21884504
How is the State of the sock Object ?
When the connection is open and you click the button again then it close the socket.
Are there any Exceptions/Errors.
0
 

Author Comment

by:Mark_H6
ID: 21898065
I did not see any execeptions.  Is there any other place I should look for execptions or errors besides the Winsock Object. I attached 2 screen shots that show the before and after of the Winsock object (sock) in the VB debugger.
Thanks
BeforeSockConnect.jpg
AfterSocketConnect.jpg
0
 
LVL 11

Expert Comment

by:melmers
ID: 21898190
The state of the socket is 6 which means connecting, so something prevent that the socket can connect. are the remote host busy or is there a firewall/desktop firewall active ?

here are the defined winsock states
sckClosed 0 Default. Closed
sckOpen 1 Open
sckListening 2 Listening
sckConnectionPending  3 Connection pending
sckResolvingHost  4 Resolving host
sckHostResolved  5 Host resolved
sckConnecting  6 Connecting
sckConnected  7 Connected
sckClosing  8 Peer is closing the connection
sckError  9 Error
0
 

Author Comment

by:Mark_H6
ID: 21898245
Firewall is off on this PC. Also I have an older Socket Program that has some of the same basic features as the one I am rewriting and that application can send and receive data to that same IP and Port.
0
 

Author Comment

by:Mark_H6
ID: 21898284
Here is some additional information. I may have gotten distracted about the socket state, because when I step down to the point where the data is sent, sock state indicates it is connected. However, when I look at wireshark I never see data get sent. Program just sits in while loop waiting for response.
0
 
LVL 11

Expert Comment

by:melmers
ID: 21898304
do you see the data which is sent by your client app ?
0
 

Author Comment

by:Mark_H6
ID: 21898326
No I do not see data in wireshark when I use the new program,  but I do see it when I use the older socket program.
0
 
LVL 11

Expert Comment

by:melmers
ID: 21899809
can you look at the state of the socket before you call the send command?
0
 

Author Comment

by:Mark_H6
ID: 21900624
It shows socket state as 7, which I believe is connected.
0
 
LVL 11

Accepted Solution

by:
melmers earned 1500 total points
ID: 21905096
and the object has the remotehost, remoteport properties filled ?
is the Protocol correct ?

if this all is ok i don't know why it is not sending. your code seems to be correct. have you tested it on another pc ?
0
 

Author Closing Comment

by:Mark_H6
ID: 31470769
Verified that RemoteHost and Remote Host are populated correctly. I am focus on socket functionality, I will write a small VB program that connects, send and recieves data to see if I can isolated what the problem with the RiTATester program. I appreciate all the help you have provide and I think all the suggestions are possible solutions and may help someone in the future and for that reason am awarding you all the points. If I find a solution I will try and amend this thread.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

596 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question