Mam takyto kod
class A
{
public string listen()
{
client = new UdpClient(LocalPort);
IPEndPoint host = new IPEndPoint(IPAddress.Any, 0);
while (true)
{
if ((client.Available > 0))
{
byte[] received = client.Receive(ref host);
string receivedString = Encoding.ASCII.GetString(received);
return receivedString;
}
}
}
}
Tato metoda hore nerobi nic ine v triede iba pocuva na porte a vracia string.
Potrebujem aby tato metoda bezala vo vlakne a aby sa hodnota stale zapisovala do textboxu vo forme1 z triedy A.