Go4Expert

Go4Expert (http://www.go4expert.com/)
-   MFC (http://www.go4expert.com/forums/mfc/)
-   -   winsock's senddata & getdata problem (http://www.go4expert.com/forums/winsocks-senddata-getdata-t15894/)

yoz1ris 21Jan2009 17:30

winsock's senddata & getdata problem
 
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,

yoz1ris

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-------

Cosmic_egg 30Jan2009 02:18

Re: winsock's senddata & getdata problem
 
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


All times are GMT +5.5. The time now is 01:40.