CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2011
    Posts
    9

    Winsock DataArrival event just triggers once

    When i send a command to a terminal, there are chances that more than more reply are sent.
    Winsock_DataArrival Triggers just once when first reply is sent. Its is not triggering when second reply is sent by the terminal.
    I telnet to the terminal and can see multiple replies coming through.

    With sockP

    If .State <> sckClosed Then
    .Close
    End If

    .Protocol = sckTCPProtocol
    .Connect sIPAddress, sIPPort

    Do
    DoEvents
    Loop Until .State = sckConnected Or .State = sckClosed

    sockP.SendData sText

    Private Sub sockP_DataArrival(ByVal bytesTotal As Long)

    Dim rData As String
    rData = ""

    sockP.GetData rData, vbString
    txtReplies.text = rData
    DoEvents

    End Sub

    DataArrival is event is just being triggered once. I dont know what am i doing wrong.
    Ex: If i send ATE0 .. i get back just ATE0 and not OK which is followed.

    I am not much familiar with winsock in vb6 and i cant upgrade to .net at this point.

    Please advise.

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Winsock DataArrival event just triggers once

    Why not use remote desktop? Or the command-line equivalent to connect to a modem
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Feb 2011
    Posts
    9

    Re: Winsock DataArrival event just triggers once

    I think it can create problem with Windows Vista and Windows 7.
    Also this should make sure that telnet service is installed on every machine using this.
    Last edited by chintan_1671; October 10th, 2011 at 10:07 AM.

  4. #4
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Winsock DataArrival event just triggers once

    Found it! VIsta & Windows 7

    Microsoft Windows [Version 6.1.7601]
    Copyright (c) 2009 Microsoft Corporation. All rights reserved.

    C:\Windows\System32>rasdial /?
    USAGE:
    rasdial entryname [username [password|*]] [/DOMAINomain]
    [/PHONEhonenumber] [/CALLBACK:callbacknumber]
    [/PHONEBOOKhonebookfile] [/PREFIXSUFFIX]

    rasdial [entryname] /DISCONNECT

    rasdial

    For Online Privacy Information please refer to
    'http://go.microsoft.com/fwlink/?LinkId=104288'
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  5. #5
    Join Date
    Feb 2011
    Posts
    9

    Re: Winsock DataArrival event just triggers once

    Ok problem is solved.
    I was just missing new line character while sending commands.

    Thanks

  6. #6
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: Winsock DataArrival event just triggers once

    Glad you go it fixed, I was about to suggest something to that effect. I have been using the Winsock control in a commmerical program I created for over 10 years now and never had an issue with it.
    Always use [code][/code] tags when posting code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured