Advertisement

Winsock multi-client with vb

Started by May 29, 2002 09:22 PM
3 comments, last by branflakes29 22 years, 8 months ago
Well, I''m trying to make a multi-user chat client/server... I have it all connecting well... When a new user connects, the server sends a message to all the other clients saying theres a new user... But then when the clients try to chat, only the newest client recieves anything! I find that really strange... because I''m using the same code to broadcast a new client connection... There must be something really stupid I''m doing... I''m guessing its something really simple... heh, any thoughts?
Are you connecting everyone to one winsock control? If so you have to send the message to every index of that control.

i.e Winsock(0).SendData to Winsock(LatestUser).SendData

If that''s not it, post your code
Advertisement
Yeah, I have a control array going... Heres my sub for sending messages... Its only in a sub because I needed it for my school project, lol


Sub SendToClients(TheData As String, TUsers as integer)
For i = 1 To TUsers
If Winsock1(i).State = sckConnected Then Winsock1(i).SendData TheData
Next i
End Sub



Like I said, Its working fine when it announces a new connection to everyone, but it only sends messages to the newest client. I''ve been reading the forums and it seems that TCP likes to let the messages pile up before sending... or something like that... Could this be it?
hahahaha! Thanks Ragonastick!!

http://gamedev.net/community/forums/topic.asp?topic_id=62016



That was soooo simple... I feel soooo dumb now, lol


---
I spelled his name wrong...
DoEvents in my for loop was all I needed btw
thanks for all your help guys

[edited by - branflakes29 on May 29, 2002 10:54:11 PM]


I was a bit puzzled when I looked at the final post and saw my name, even though I hadn''t replied

Trying is the first step towards failure.
Trying is the first step towards failure.

This topic is closed to new replies.

Advertisement