• Advertisement

Archived

This topic is now archived and is closed to further replies.

Winsock multi-client with vb

This topic is 5745 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites


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.

Share this post


Link to post
Share on other sites

  • Advertisement