Hi guys, little problem with my Chat application.
For introduction, I got my chat working (execpt for 2-3 exception popping on immediate window, but thats for later)
Before I wrote a specific private sub, When I was opening for example: Room 1 and 3, then writing "Test" in Room 1, the message after pressing the button Send was going at Room 1 AND 3.
So it seems that the message would go everywhere. I fix that with a little compare with : ok if the Sender room is equals to the receiver room then Write the message, else do not. But it is quite cheating: Its fine for 3 rooms, but If We have 500 rooms or even 4000 , it will just lag as hell.
So my problem goes as follow: The message needs to stay at the Right Room. That meens what? When I create my SocketClient, Do I have to change the port ? So each table would have uniquely chats ?? (I GUESS NOT)
Or Do I have to create multiple TCPListener ? (I guess not..)
My Room_Load goes as follow:
Private mobjClient As TcpClient
Private Sub frmRoom_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
mobjClient = New TcpClient("localhost", 5000)
mobjClient.GetStream.BeginRead(marData, 0, 1024, AddressOf DoRead, Nothing)
Send(username + " as joined. " + CStr(tableID))
Ok so here I create a new TcpCLient each time a room is going open, always on port 5000.
What do I have to do to fic the problem of the message needs to stay at the right place ?