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

Sometime receiving half data #1105

Open
aftabi2v opened this issue Sep 23, 2024 · 0 comments
Open

Sometime receiving half data #1105

aftabi2v opened this issue Sep 23, 2024 · 0 comments

Comments

@aftabi2v
Copy link

aftabi2v commented Sep 23, 2024

Environment

NetMQ Version:    4.0.1.13
Operating System:  Windows 10 x64
.NET Version:     4.7.2

Explanation

My netmq client is receiving half data from the server. This happens around 0.1 % times. Since I am receiving data of a model I am unable to deserialize the data.

Code

public ZeroMqVAClient(string ip, string port, string topic)
{
    try
    {
        subscriber = new SubscriberSocket();
        subscriber.Options.ReceiveHighWatermark = 1000;
        address = "tcp://" + ip + ":" + port;
        subscriber.Connect(address);
        subscriber.Subscribe("");
        poller = new NetMQPoller { subscriber };
        subscriber.ReceiveReady += subscriber_ReceiveReady;
        poller.RunAsync();
    }
    catch (Exception ex)
    {

        ExceptionHandler.handleException(ex.Message);
    }
}

private void subscriber_ReceiveReady(object sender, NetMQSocketEventArgs e)
{
    string messageReceived = string.Empty;
    try
    {

        if (subscriber.TryReceiveFrameString(out messageReceived))
        {
            var evnt = JsonConvert.DeserializeObject<List<VAAlertArgs>>(messageReceived);
            foreach (var item in evnt)
            {
                OnAlertRecievedEvent(item);
            }

        }
    }
    catch (Exception ex)
    {
        ExceptionHandler.handleException(ex);
    }
}

The average message received size is 149594 character but sometimes I only get 8183 character of data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant