.NET TCP Client/Server communication issue
- by Jamie
What I'm currently trying to do is make a very basic webchat for irc using silverlight.
Basically how I'm trying to do it is have a tcp server listening for connections from silverlight. When a client connects it creates a new connection to irc and data is passed to/from the client/irc via the server application.
I've gotten it to work fine for one client connection, but as soon as two (or more) clients connect multiple connections are made to irc but all data passed from the clients just goes through the latest irc connection (if that makes sense).
For example Client1, Client2 and Client3 are all connected to irc, but no matter who sends data it all comes through Client3.
Between the client and server app it recognizes the data coming in from different clients so i believe the problems lies within the way I've connected to the irc. When the TCP server accepts a new client a new thread is made to listen to incoming data, and from there a new thread is made to connect to irc. I'm sure thats where the problem exists, but I've confused myself a lot now and am wondering if anyone can help me figure out a solution.
EDIT: What I think is the problem, is that it can't distinguish which thread the specific client is using, so it just sends it via the latest one. Can this even be done?