Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WinForms] Client.Receiver.DataAvailable is never true after SendData #1

Closed
sturlath opened this issue Mar 3, 2019 · 0 comments
Closed
Labels
bug Something isn't working

Comments

@sturlath
Copy link
Owner

sturlath commented Mar 3, 2019

When using the WinForms client to send data , the _stream.DataAvailable in Client.Receiver is never true, meaning that there is never a reply from the server we pick up.

else if (_stream.DataAvailable)
    {
    var b = new byte[1024];
    var bytes = _stream.Read(b, 0, b.Length);
    ...              

That probably means that when the button is clicked its run on some other thread because it works with the ClientConsole

        private void btnSendData_Click(object sender, EventArgs e)
        {
            // This call does not fire the MainDataReceived event in WinForms but does in the console app!
            GenericResult<bool> test = client.SendData(txtDataToSend.Text);
        }

Here is something I think could be of help but I haven't figured it out yet, Control.Invoke Method (see example at the bottom)

Somebody go any ideas?

@sturlath sturlath added the bug Something isn't working label Mar 3, 2019
@sturlath sturlath closed this as completed Mar 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant