cruny cruny - 6 months ago 74
C# Question

c# Pass Socket Connection

I have a List of sockets

List<Socket> Clients;

is receiving Data in a UI Form works perfectly , but i want to pass that socket to another Form2 so :

public Form2(Socket Client)

this._Client = Client;

in my Form1:

Form2 f2 = new Form2(this.Clients[0]);

My issue is i don't receive from the New socket i still receive from socket on Form1 !
i m confused how can i receive from the new socket !


There should only be one that will receive data from the socket. You should pass the data instead of the socket.

public class Form2 : Form
    public void HandleData(byte[] data)