When passing TcpClient as a parameter, does it pass it as a parameter just like any other variable/class, or does it do it by referencing? Let's say I pass a parameter to a new class in the new class Constructor and I declare a new variable of TcpClient which I assign the parameter to. At the end of this class (well, it's a Form, but anyway..) I perform TcpClient.Close() to close this new instantiation of TcpClient but it closes the other one too!
Here's a more detailed run-down of what's going on in the program:
Two clients contact each other, if both confirm the game, one sends confirmation to Server. Server gets both TcpClients from a hashtable, and then creates a new class with the two TcpClient's as parameters. The server also sends back a confirmation that things are ready for the clients.
The clients now create a new instantiation of the form with the TcpClient to the Server as a parameter.
Things run smoothly and fine the first time round, but when the two clients close down the forms and then try and re-initiate a game nothing happens. There's a way I can get the form to initiate (which means initial contact to the server works) by taking out TcpClient.Close() of the Form_onClosing() method in the client. The problem with this is that nothing else happens beyond the initial contact. The forms load, the server creates a new class but no further communication occurs which leads me to believe that there's something going wrong with either the streams or possibly one of the TcpClients... Any ideas please? I've been racking my brain on this for aaages!
Here's a more detailed run-down of what's going on in the program:
Two clients contact each other, if both confirm the game, one sends confirmation to Server. Server gets both TcpClients from a hashtable, and then creates a new class with the two TcpClient's as parameters. The server also sends back a confirmation that things are ready for the clients.
The clients now create a new instantiation of the form with the TcpClient to the Server as a parameter.
Things run smoothly and fine the first time round, but when the two clients close down the forms and then try and re-initiate a game nothing happens. There's a way I can get the form to initiate (which means initial contact to the server works) by taking out TcpClient.Close() of the Form_onClosing() method in the client. The problem with this is that nothing else happens beyond the initial contact. The forms load, the server creates a new class but no further communication occurs which leads me to believe that there's something going wrong with either the streams or possibly one of the TcpClients... Any ideas please? I've been racking my brain on this for aaages!