Skip to content

Sometime receiving half data #1105

Open
@aftabi2v

Description

@aftabi2v

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions