Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with accumulating data

Status
Not open for further replies.

GDX

Programmer
Jun 4, 2000
186
US
I want to make a variable to hold data recieved via winsock until the client hits enter this is what I have so far:

Private Sub WinsockServer_DataArrival(Index As Integer, ByVal bytesTotal As Long)
Dim indataz As String
Dim gdz As String
indy = Index
WinsockServer(indy).GetData indataz
gdz = gdz + indataz
If InStr(gdz, vbCrLf) >= 1 Then
MsgBox "Got Client Return"
End If
End Sub

My problem is gdz is not holding any data!!!! anyone know why? Gordon R. Durgha
gd@vslink.net
 
Hi

I have never used the Winsock control before so bear with me. The question I'm asking is this.
Does this method fire everytime data arrives or just once off? It seems to me that whenever a bit/byte whatever "arrives", this method executes. This would mean that your variables gdz & indataz are "cleared" everytime data "arrives".
If this is the case then you should dimension gdz as a member or static variable.
I would suggest member rather thatn static but that's just my preference. ;-)

Option Explicit

Private m_Gdz As Whatever

Private Sub WinsockServer_DataArrival( _
Index As Integer, ByVal bytesTotal As Long)

Dim indataz As Whatever
'....rest of code
'....goes here

End Sub

Of course I could be off the point & with that said I'll continue with my christmas left-overs & leave you in peace.

Seasons Greetings
caf
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top