Help/Problem timeout sendandwait
See original GitHub issueHello,
I really need help with the Server/Client… My Configuration of the Server is
public static class AsyncServer
{
private static string serverIp = "10.0.0.46";
public static int ServerPort = 9000;
private static bool useSsl = false;
private static WatsonTcpServer server = null;
private static string certFile = "";
private static string certPass = "";
private static bool debugMessages = false;
private static bool acceptInvalidCerts = true;
private static bool mutualAuthentication = true;
public static void ConfigServer()
{
server = new WatsonTcpServer(serverIp, ServerPort);
server.ClientConnected += ClientConnected;
server.ClientDisconnected += ClientDisconnected;
server.MessageReceived += MessageReceived;
server.SyncRequestReceived = SyncRequestReceived;
// server.PresharedKey = "0000000000000000";
// server.IdleClientTimeoutSeconds = 10;
logger.Info("Server configuration done");
}
public static void StartServer()
{
Task serverStart = server.StartAsync();
}
My client:
public static class AsyncClient
{
public static string ServerIp { get; set; }
public static int ServerPort { get; set; }
private static bool useSsl = false;
private static string certFile = "";
private static string certPass = "";
private static bool debugMessages = false;
private static bool mutualAuthentication = true;
private static WatsonTcpClient client = null;
private static string presharedKey = null;
public static void ConfigClient()
{
client = new WatsonTcpClient(ServerIp, ServerPort);
client.ServerConnected += ServerConnected;
client.ServerDisconnected += ServerDisconnected;
client.MessageReceived += MessageReceived;
client.SyncRequestReceived = SyncRequestReceived;
}
public static void StartClient()
{
try
{
Task startClient = client.StartAsync();
}
catch (Exception ex)
{
logger.Error("Could not connect to server: {0} Port: {1}", ServerIp, ServerPort);
}
}
I want to SendAndWait:
public static void SendAndWait()
{
int timeoutMs = 20000;
string userInput = "testingstring";
try
{
SyncResponse resp = client.SendAndWait(timeoutMs, userInput);
if (resp.Metadata != null && resp.Metadata.Count > 0)
{
logger.Info("Metadata:");
foreach (KeyValuePair<object, object> curr in resp.Metadata)
{
}
}
}
catch (Exception e)
{
}
}
At server side
private static SyncResponse SyncRequestReceived(SyncRequest req)
{
if (req.Metadata != null && req.Metadata.Count > 0)
{
logger.Info("Metadata:");
foreach (KeyValuePair<object, object> curr in req.Metadata)
{
logger.Info(" " + curr.Key.ToString() + ": " + curr.Value.ToString());
}
}
Dictionary<object, object> retMetadata = new Dictionary<object, object>();
retMetadata.Add("foo", "bar");
retMetadata.Add("bar", "baz");
return new SyncResponse(req,retMetadata, "Here is your response!");
}
It is the same sample as stored in git. If i download the current version from git and test ist, everything is fine. But if i do the same thing with the code above I always get the timeout exception (no msg received after timeout) If i debug then the server recognize the incomming msg and work and “send” back.
Can anybody help me?
nice greetings phil
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (4 by maintainers)
Top Results From Across the Web
How to differentiate null response from timeout using Axon ...
I am sending a command and expecting a result via CommandGateway.sendAndWait(Object command, long timeout, TimeUnit unit) method :
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry for the late answer… i fixed my problem… it was my architecture! thanks for support…
Awesome thanks @philipphagen87 please let me know if I can help in the future.