question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SendAndWait works only the first time

See original GitHub issue

Hi jchristin, today I’m trying to upgrade my program to use the new 4.8.1 version of WatsonTcp from the far 4.1.5 one that always worked finely for me.

I’ve noticed that now it’s very very quick to send messages, with my old 4.1.5 version i could send up to 65 messages per second (async messages), and now with the 4.8.1 i can reach the outstanding speed of 1500 msg/sec!! so awesome!

But sadly thre is also a problem… 😦 If I call on client a SendAndWait it works fine, but only the first time, if then I call another SendAndWait this hangs until the timeout exception…

this is my sample client code:

            cli = new WatsonTcpClient("localhost", 23456);
            cli.Events.ServerConnected += Cli_ServerConnected;
            cli.Events.MessageReceived += Cli_MessageReceived;
            cli.Settings.DebugMessages = false;
            cli.Connect();
            cli.Send("Single message from client-1");
            cli.Send("Single message from client-2");
            cli.Send("Single message from client-3");

            SyncResponse srsp = cli.SendAndWait(30000, "1"); 
            Console.WriteLine(Encoding.UTF8.GetString(srsp.Data));
            srsp = cli.SendAndWait(30000, "1");  <<----- this row hangs and after 30 secondt fires a TimeoutException
            Console.WriteLine(Encoding.UTF8.GetString(srsp.Data));

and this is the server side that works only for the first time, for the second SendAndWait this is never fired

        private static SyncResponse SyncRequestReceived(SyncRequest req)
        {
            Console.WriteLine($"Syncrequest received from {req.IpPort}: {Encoding.UTF8.GetString(req.Data)}");
            SyncResponse ret;

            int delay = 0;
            int.TryParse(Encoding.UTF8.GetString(req.Data), out delay);
            if (delay == 0)
                delay = 1;

            System.Threading.Thread.Sleep(1000*delay);
            ret = new SyncResponse(req, $"Long work done :-) {delay}");

            Console.WriteLine("Syncrequest completed");
            return ret;
        }

many thanks in advance for your great work! Michele

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
davidhayscommented, Mar 20, 2021

4.8.2 works for me.

1reaction
davidhayscommented, Mar 19, 2021

I don’t know if this is another issue, but on 4.8.1, when I do WatsonTcpServer.Send (or SendAsync) multiple messages from the server, the client MessageReceived is only fired once, I’ve rolled back to 4.8.0 and it fires for every message.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issue while sending a lot of commands - Axon Server
Hi guys, I'm using Axon/Server 4.4.3. In certain cases, I need to send a lot of commands in a short time (roughly 20k...
Read more >
When using a rest api, commandGateway.send is not ...
In Axon 3, when using a POST rest api, commandGateway.send is not working async and the response is waiting until the command is...
Read more >
Understanding of Axon Event Sourcing - spring boot
Once this CommandHandler is finished executing, the aggregate object doesn't exist anymore. Now in my TestRunner class again, the Command ...
Read more >
sendAndWait - method of org.openqa.selenium.devtools. ...
Use the sendAndWait method in your next Selenium project with LambdaTest Automation ... works most of the time and fails only on strange...
Read more >
Synchronously Send (and wait for) commands in AutoCAD ...
I have set up a pedit method like the above example.If I call "Test7" from the command line it works but if I...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found