I am having trouble as I am trying to run my clientsocket.connect until a connection has been established. However it is not running my connect method and I cannot seem to be able to diagnose why that is
private static ClientSocket clientSocket = new ClientSocket();
private delegate void connection();
public Form1()
{
InitializeComponent();
connection waitConnect = callConnect;
Console.WriteLine("before callconnect invoke");
IAsyncResult asyncConnect = waitConnect.BeginInvoke(null, null);
Console.WriteLine("Main method now has control");
waitConnect.EndInvoke(asyncConnect);
}
private void callConnect()
{
while (!clientSocket.connected)
{
Thread.Sleep(1000);
Console.WriteLine("still connecting...");
clientSocket.connect("127.0.0.1", 43);
}
}
clientsocket.connected checks a connection has been established.
If more information is needed I can provide.
Thank you