winsock's senddata & getdata problem

Discussion in 'MFC' started by yoz1ris, Jan 21, 2009.

  1. yoz1ris

    yoz1ris New Member

    Jan 16, 2009
    Likes Received:
    Trophy Points:
    company worker
    southern asia
    Dear friends:shy:,
    I have try to make a simple program that asks users to input sth (name, age, etc) in computer A.
    And then, the program (in comp A) sends the collected data to comp. B via winsock.
    I expect the program in comp B to list the result as follow.

    Name Age Sex
    ------- ---- ---
    John 20 M
    Diane 18 F
    Xisco 50 M
    Wang 46 F

    But, in point of fact the program (in comp B) shows the result like this:
    Name Age Sex
    ------- ---- ---
    John 20 M Diane 18 F Xisco 50 M ...
    John 20 M Diane 18 F Xisco 50 M ...
    John 20 M Diane 18 F Xisco 50 M ...
    John 20 M Diane 18 F Xisco 50 M ...

    Please, could anybody help me find the solution?:embarasse
    Sincerely yours,


    Excerpt of the code:
    ...(in a module of program A)...
    If lResult <> 0 Then _
    strDat = strName & vbTab & strAge & vbTab & strSex
    frmSend.w2.SendData strDat
    End Function

    ...(in a form of program B)...
    Private Sub w1_DataArrival(ByVal bytesTotal As Long)
    Dim strDat As String
    w1.GetData strDat
    lstProc.AddItem strDat
    End Sub
    -------end of excerpt-------
  2. Cosmic_egg

    Cosmic_egg New Member

    Jul 21, 2008
    Likes Received:
    Trophy Points:
    comp B is just displaying what is sent in COMP A
    Why don't you format the data either before sending or after receiving to display it according to your need.

    There seems to be no problem with senddata and getdata

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice