このコンソールコードをフォームコードに変換したい:
public void catching(string[] args)
{
UdpClient udpc = new UdpClient(args[0], 2055);
IPEndPoint ep = null;
while (true)
{
Console.Write("Name: ");
string name = Console.ReadLine();
if (name == "") break;
byte[] sdata = Encoding.ASCII.GetBytes(name);
udpc.Send(sdata, sdata.Length);
byte[] rdata = udpc.Receive(ref ep);
string job = Encoding.ASCII.GetString(rdata);
Console.WriteLine(job);
}
}
click
これをボタンイベントに入れたい:
private void button1_Click(object sender, EventArgs e)
{
}
しかし、私はこの行でエラーが発生します:
UdpClient udpc = new UdpClient(args[0], 2055);