Giter Site home page Giter Site logo

secs4net's People

Contributors

aka-nse avatar bitdeli-chef avatar megla-tlanghorst avatar mkjeff avatar westjeffho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

secs4net's Issues

Send Primary Message Format

Hello,

If I am attempting to send a primary message, what format do I use to encode the information? I have tried to decode the format from the source code but it has proven very difficult. Could you please give an example of how you would enter a primary message and what its associated expected response would look like?

too many T3

Describe the bug
WINFROM .NET 4.6.2 : HSMS 100ms
too manny t3 timeout
日志记录:Received unexpected secondary message[0x1A4EE97B]. Maybe T3 timeout.
mayby is a bug

To Reproduce
WINFROM .NET 4.6.2 :
HSMS 100ms
image

Desktop (please complete the following information):

  • OS: [windows]
  • CS: WINFROM .NET 4.6.2

NullReferenceException

Describe the bug
NullReferenceException
To Reproduce
Steps to reproduce the behavior:

  1. start SecsDevice and DeviceWorkerService two projects simultaneously in VS
  2. after the main form appear, make the break point at the MessageHeader.cs file EncodeTo method buffer.Advance(10) (49 line)
  3. press F11 to run step by step
  4. in the HsmsConnection.cs file StopPipeDecoder method, 324 line will occur a NullReferenceException bug

Expected behavior
A clear and concise description of what you expected to happen.

Desktop (please complete the following information):
Windows 10, VS2022

Additional context
Add any other context about the problem here.

core folder in secs4net project SECSGEM.cs use error

Hi.

I'm trying to use only the secs4net project in the core folder.
However, an error occurs. In the SecsGem.cs file, at line 430
'System.IO.FileNotFoundException' (Secs4net.dll)

An error occurs. Do you need to include other projects?

Unable to install Nuget Package on VS 2017

Hi, @mkjeff I tried to install the Nuget Package but it keep failing to install.

The error message: Could not install package 'Secs4Net 1.0.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.6.1', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

I'm currently using Visual Studio 2017 on Windows 10 and the project target framework is .NET 4.6.1.
Would be great if you could provide some suggestions on this, thank you!

Nuget PrimaryMessageReceived is Action instead of EventHandler

First off, thank you for your work with this project and turning into a NuGet package.

I'm hoping to find some time to contribute in the future. However, I believe I've found a discrepancy between the master and recent NuGet release.

When attempting to use the NuGet package (2.0.0), the compiler noticed that PrimaryMessageReceived was Action<PrimaryMessageWrapper> instead of EventHandler<PrimaryMessageWrapper>.

when sending or receiving a '<L[0]>', `Item.Count` will throw an exception

Describe the bug
when sending or receiving a '<L[0]>', Item.Count will throw an exception

To Reproduce
Steps to reproduce the behavior:

  1. For example, send a S1F13 CR as
S1F13_EstablishComm: S1F13 W
<L[0]
>
.
  1. in SmlExtension.ParseItem, Since <L[0]> is a none List, the method L() is called.
  2. in SmlExtension.Write, when executing the statement writer.Write(item.Count);, the item.Count will throw an exception :"system.entrypointnotfoundexception"

Desktop (please complete the following information):

  • OS: Windows 10 1909, 18363.900

Additional context
In item.Count, I add the following comparison to determine whether the _values is an empty item.

 if(_values == Enumerable.Empty<Item>())
 {
     return 0;
 } 

and then it works fine.
I have started to learn .net core since the last week, and I am wondering whether there is a better solution.

How to safely get array pointer by Unsafe.AsPointer without fixed it?

It is easy to use Unsafe API convert managed array to unsafe pointer
e.q.

var buffer = new byte[10];
byte* target = (byte*)Unsafe.AsPointer(ref buffer[0]);

But GC only guarantees the fixed memory will not be relocated by Compact Phase.
and fixed(pinned) managed object could cause serious fragment problem.

As this article mentions

When you do need to pin, here are some things to keep in mind:

Pinning for a short time is cheap.
Pinning an older object is not as harmful as pinning a young object.
Creating pinned buffers that stay together instead of scattered around. This way you create fewer holes.

The upcoming version of this project using a bit of UnSafe API.

Maybe I use it in wrong way.
Have any suggestion?

Cannot cast type "PooledAwait.ValueTaskCompletionSource1[System.Object]" to type "System.Threading.Tasks.TaskCompletionSource1[System.Object]"

I created 2 buttons in winform app.

SecsGem? _secsGem;
HsmsConnection? _connector;
CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();

private async void StartButton_Click(object sender, EventArgs e)
{
    _secsGem?.Dispose();
    if (_connector is not null)
    {
        await _connector.DisposeAsync();
    }
    var options = Options.Create(new SecsGemOptions
    {
        IsActive = false,
        IpAddress = "127.0.0.1",
        Port = 5000,
        SocketReceiveBufferSize = 65535,
        DeviceId = (ushort)0,
    });
    var logger = new SecsLogger();
    _connector = new HsmsConnection(options, logger);
    _secsGem = new SecsGem(options, _connector, logger);
    _ = _connector.StartAsync(_cancellationTokenSource.Token);
    await foreach (var primaryMessage in _secsGem.GetPrimaryMessageAsync(_cancellationTokenSource.Token))
    {
        recvBuffer.Add(primaryMessage);
    }
}

private async void EndButton_Click(object sender, EventArgs e)
{
    if (!_cancellationTokenSource.IsCancellationRequested)
    {
        _cancellationTokenSource.Cancel();
        _cancellationTokenSource.Dispose();
    }
    if (_connector is not null)
    {
        await _connector.DisposeAsync();
    }
    _secsGem?.Dispose();
    _cancellationTokenSource = new CancellationTokenSource();
    _secsGem = null;
    recvBuffer.Clear();
}

I click start button and then click end button, exception occured in _cancellationTokenSource.Cancel().
Cannot cast an object of type "PooledAwait.ValueTaskCompletionSource1[System.Object]" to type "System.Threading.Tasks.TaskCompletionSource1[System.Object]".

Bit mask of 'Stream' field is wrong

Describe the bug
Bit mask used to decode a message header not contains bit6.

File:MessageHeader.cs
Function: Decode

S = (byte)(s & 0b0111_111),

The integer literal 0b0111_111 should be 0b0111_1111 or 0b1111_111.

Question

hi, I'm very interested in your project. when I'm right is this the site from host or from both sides?

my equipment simulation send auto S1F13 - now your sample must send S1F14 - i'm not shoure how?

can you help me?

best regards

Response not sent in V2.0.0-RC01

Describe the bug
I mainly develop with .Net Core and so I tried to use the 2.0.0-RC01 version on nuget.
Our equipments send an S1F13- Request to the Host after the connection is established.
The Host should then reply with an S1F14 acknowledge.

After implementing the host- side software, we encountered the following behaviour:

The Host receives the PrimaryMessage, but the reply does not reach the equipment.
I then tested the same scenario with the 1.0.0 version from nuget.
This version worked as expected.

I programmed a little sample project to illustrate the behaviour.

To Reproduce
Steps to reproduce the behavior:

with version 1.0.0:
Start the project V1_Passive and then V1_Active after that. In the console you see that the connection is established, the equipment sends the S1F13- Request and the host responds accordingly.

with version 2.0.0-RC01:
Start the project V2_Passive and then V2_Active after that. In the console you see, that the connection is established and the equipment sends the request, but the hosts response does not reach the equipment. Finally the T3- timer runs out after 3 retries.

Expected behavior
The response from the host should reach the equipment like in version 1.0.0.

Desktop (please complete the following information):

  • OS: Windows 10 1709
  • Visual Studio 2019 Version 16.1.6
  • Net Core SDK 2.2.500
  • Net Framework 4.7.2

Additional context
Here is the test project to help you:
Secs4NetTest.zip

Is v2 supposed to be used? Or should I use v1 for now, until v2 is officially released?
If so, is there a way for you to make v1 compatible with .Net Standard, so that we can use it in .Net Core?

analysis first s1f13 incorrect,and then T6 outtime occured。[Net6]

Application is passive. set T6=10sec ,linkTestEnable=true
1、 start application ,
2 、recieve [SelectRequest] and then send [SelectResponse]
3、Host(Active) send S1F13 msg immediately ###
'S1F13'W
<L [0]
<A[2] AA>
<A[1] q>
>
.
4、And Then this bug may occur。 when after LinkTestRequest,report T6 timeout
5、reconnect , and then send s1f13 ,all is Ok.

Debug info :

[0x7FFBF546FEE0] ANOMALY: use of REX.w is meaningless (default operand size is 64)
[0x7FFBF546ADC0] ANOMALY: use of REX.w is meaningless (default operand size is 64)
libpng warning: iCCP: cHRM chunk does not match sRGB
2022-12-15 15:36:24.1698|Info|SECS ConnectionState change:Connecting
2022-12-15 15:36:24.1698|Info|HSMSState ->Disc
2022-12-15 15:36:24.6417|Info|SECS ConnectionState change:Connected
2022-12-15 15:36:24.6417|Info|HSMSState ->Disc
2022-12-15 15:36:24.6417|Info|Start T7 Timer: 10 sec.
2022-12-15 15:36:24.6512|Info|Recieve socket data:len=14
00 00 00 0A FF FF 00 00 00 01 80 00 00 0B ### //get selectedRequest
1:Read data from reader,required=4,[0,14],data=00 00 00 0A FF FF 00 00 00 01 80 00 00 0B
Get new message with length: 10,data=00 00 00 0A
Get message(id:8000000B) header
2022-12-15 15:36:24.6668|Info|Receive Control message: SelectRequest
2022-12-15 15:36:24.7040|Info|Sent Control Message: SelectResponse[id=0x8000000B]
2022-12-15 15:36:24.7073|Info|Recieve socket data:len=14
00 00 00 0A FF FF 00 00 00 05 80 00 00 0C
2022-12-15 15:36:24.7073|Info|SECS ConnectionState change:Selected
2022-12-15 15:36:24.7073|Info|HSMSState Change,Disc->Conn
2022-12-15 15:36:24.7073|Info|HSMSState ->Conn
2022-12-15 15:36:24.7073|Info|Stop T7 Timer
1:Read data from reader,required=4,[0,14],data=00 00 00 0A FF FF 00 00 00 05 80 00 00 0C
Get new message with length: 10,data=00 00 00 0A
Get message(id:8000000C) header
2022-12-15 15:36:24.7073|Info|Receive Control message: LinkTestRequest
2022-12-15 15:36:24.7073|Info|Sent Control Message: LinkTestResponse[id=0x8000000C]
2022-12-15 15:36:26.3150|Info|Recieve socket data:len=14
00 00 00 13 00 00 81 0D 00 00 00 00 00 20 ### //recieve s1f13 msg head
2022-12-15 15:36:26.3150|Info|Recieve socket data:len=9
01 02 41 02 41 41 41 01 71 ### //recieve s1f13 msg body
2:Read data from reader,required=4,[0,9],data=00 00 00 13 00 00 81 0D 00 00 00 00 00 20 01 02 41 02 41 41 41 01 71
Get new message with length: 19,data=00 00 00 13
Get message(id:00000020) header
Get data message(id:00000020) with total bytes: 19 and decoded directly
Get new message with length: 37814849,data=02 41 02 41 ### 37814849 ???? so long???
1:require 10,but not enough ,data=41 41 01 71,AdvanceTo=》[5,9]
2022-12-15 15:36:26.3366|Info|<--[32] 'S1F13'W ### analysis incorrect
<L [0]
>
.

2022-12-15 15:36:26.3665|Info|-->[32] S1F14:'S1F14'
<L [2]
<B [1] 0x00>
<L [0]
>
>
.

2022-12-15 15:36:34.1775|Info|Sent Control Message: LinkTestRequest[id=0x63C14577]
2022-12-15 15:36:34.1775|Info|Recieve socket data:len=14
00 00 00 0A FF FF 00 00 00 06 63 C1 45 77 ### recieve LinkTestResponse
2:Read data from reader,required=10,[5,14],data=41 41 01 71 00 00 00 0A FF FF 00 00 00 06 63 C1 45 77
Get message(id:000AFFFF) header
Decoded List[0]
Get data message(id:000AFFFF) decoded by data chunked
Get new message with length: 1635,data=00 00 06 63
2022-12-15 15:36:34.1775|Info|<--[720895] 'S1F113'
<L [0]
>
.

1:require 10,but not enough ,data=C1 45 77,AdvanceTo=》[11,14]

NLog.Logger
2022-12-15 15:36:39.2069|Error|T6 Timeout[id=0x63C14577]: 5 sec. ### //T6 timeout
NLog.Logger
2022-12-15 15:36:39.2069|Error|T6 Timeout[id=0x63C14577]: 5 sec.
2022-12-15 15:36:39.2069|Info|SECS ConnectionState change:Retry
2022-12-15 15:36:39.2069|Info|HSMSState Change,Conn->Disc
2022-12-15 15:36:39.2069|Info|HSMSState ->Disc
2022-12-15 15:36:39.2641|Info|SECS ConnectionState change:Connecting
2022-12-15 15:36:39.2641|Info|HSMSState ->Disc


And This problem does not occur frequently,It is easy to appear when starting。

I can't debug into Header.EncodeTo

Describe the bug
使用SecsDevice调试时,可以成功连接EQP,但是连接之后一直无法发送Selected消息。

To Reproduce
Steps to reproduce the behavior:

  1. 启动SecsDevice项目;
  2. 输入合适的IP和Port;
  3. 点击Enable按钮;
  4. See Error

Expected behavior
HOST发送Selected消息并且成功建立连接

Screenshots
2019-06-25_102224

Desktop (please complete the following information):

  • OS: Windows 10 1803
  • Browser Chrom/Edge
  • Version

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]

  • OS: [e.g. iOS8.1]

  • Browser [e.g. stock browser, safari]

  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Secs4Net

Class Secs4Net can not be loaded

Is there any reason that DESELECT related MessageType enums are commented out?

In lastest version:

public enum MessageType : byte
    {
        DataMessage       = 0b0000_0000,
        SelectRequest     = 0b0000_0001,
        SelectResponse    = 0b0000_0010,
        //Deselect_req      = 0b0000_0011,
        //Deselect_rsp      = 0b0000_0100,
        LinkTestRequest   = 0b0000_0101,
        LinkTestResponse  = 0b0000_0110,
        //Reject_req        = 0b0000_0111,
        SeperateRequest   = 0b0000_1001
    }

In previous versions:

enum MessageType : byte {
        DataMessage = 0,	    // 00000000
        SelectRequest = 1,		// 00000001	ReplyExpected
        SelectResponse = 2,		// 00000010
        //Deselect_req = 3,	    // 00000011	ReplyExpected
        //Deselect_rsp = 4,	    // 00000100
        LinkTestRequest = 5,	// 00000101	ReplyExpected
        LinkTestResponse = 6,	// 00000110
        //Reject_req = 7,	    // 00000111
        SeperateRequest = 9	    // 00001001
    }

Is there any specific reason or I could just implement them?

Device reply S9Fx not catch SecsException

Hi, i try to test when my device reply S9F5
but An unhandled exception of type 'System.AggregateException' occurred in mscorlib.dll

The error was point to SecsGem.cs line 466, method - SendDataMessageCompleteHandler(object socket, SocketAsyncEventArgs e)

if (_replyExpectedMsgs.ContainsKey(completeToken.Id))
            {
                **if (!completeToken.Task.Wait(T3))**
                {
                    _logger.Error($"T3 Timeout[id=0x{completeToken.Id:X8}]: {T3 / 1000} sec.");
                    completeToken.SetException(new SecsException(completeToken.MessageSent, Resources.T3Timeout));
                }
                _replyExpectedMsgs.TryRemove(completeToken.Id, out completeToken);
            }

Try To start EAP Host

Hi, I'm trying to start the EAP Host. Then there is an error dialogue. It says "相關組態檔找不到"
image
The problem is I can't debug into the code. It's strange. why.

memory leak??

Hi,

Is there anyone facing the memory grow issues running over 24/7 ?
From my observation, the memory allocations of my application
will keep on increasing upon sending the new secs message.
Is it normal ?

Can not open secsdevice form

Describe the bug
Can not open secsdevice form
To Reproduce
Steps to reproduce the behavior:

  1. Go to Device project -> SecsDevie->double click Form1

Expected behavior
A clear and concise description of what you expected to happen.
image

Screenshots
If applicable, add screenshots to help explain your problem.
image

Desktop (please complete the following information):

  • OS: [e.g. iOS] win 7
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

SECS-I (E4) support

Hi,

Is that possible to add in the connection mode for serial port using SESC-I standard?

Decode Hex to Ascii

A way to decode hex into their SML Ascii formats would be nice.

Example:
From
00 00 06 06 00 00 00 00 6e 2a 21 01 00
To
S6F6
<B[1] 00>

SecsDevice based on NET461/NET472 cannot send SecsItem which contains large array

Describe the bug
NET461/NET472 cannot send SecsItem which contains large array while NET5.0/6.0 works ok

To Reproduce
Steps to reproduce the behavior:

  1. use secsDevice project, and change "btnSendPrimary_Click" func, original code is like this:[length of large array is 1136532, file size is about 1M, 200Kb file also tested, failed same.]
    image

  2. go to samples/SecsDevice/bin/Debug/net461;net472;net6.0-windows, open two same SecsDevice.exe window.

  3. set up one as active, another as passive. wait for selected status.

  4. click "send" button, net6.0 works correctly, net461/net472 error is like this:
    image
    image

Expected behavior
net461/net472/net6.0 should act same for large array items.

Screenshots
as previous.

Desktop (please complete the following information):

  • OS: win10

Could you help me on this issue?

System.IO.FileNotFoundException: could not load...“System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51”

@a-v-kalabuhov @kyunggyuyeol

i got an issue which is that "system.memory version=4.0.1" could not be loaded.
details info as below:

System.IO.FileNotFoundException: could not load...“System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51”
Filename:“System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51”
   at Secs4Net.StreamDecoder.<.ctor>g__GetMessageHeader|23_1(Int32& length, Int32& need)
   at Secs4Net.StreamDecoder.<.ctor>g__GetTotalMessageLength|23_0(Int32& length, Int32& need)
   at Secs4Net.StreamDecoder.Decode(Int32 length)
   at Secs4Net.SecsGem.<.ctor>g__SocketReceiveEventCompleted|84_9(Object sender, SocketAsyncEventArgs e)

the vs2017 has been updated system.memory version to 4.5.3 in csproj file.

secs4net project info:
target framework: .Net Standard 2.0
vs 2017

any ideas will be appreciated.
thank you

Function number error in json

Function number error in JsonExtension and same as in v2 JsonWriter.

await jwtr.WritePropertyNameAsync(nameof(msg.F));
await jwtr.WriteValueAsync(msg.S);

v2

jwtr.WriteNumber(nameof(msg.F), msg.S);

Sometime can't reply message

Hi,
I found some issue when I send sec message from host to equipment(secs4net) as S1F1
but sometime equipment not reply S1F2, How do I do that?

image

Where are unit test projects?

I'm interested in this project and I want to contribute if you allow.

But I cannot find any unit test, so I'm not able to validate my modifications.

If you have unit test projects, can you commit them?

Occur T3 timeout while sending many grouped messages

Describe the bug
secs4net V1 issue only.
Total 500 messages, let 100 messages as a group, 5 groups a set
Test the maximum throughput of the sending message at the same time
will lead some message occur T3 Timeout. (TokenCach Remove message is earlier than doing TryGetValue)

To Reproduce

  1. Make sure that the XUnit project is .NetFramewrok4.8( .NetCore test successfully)
  2. Add the following code to the XUnit test project
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Net;
using Xunit;
using Secs4Net;

namespace Secs4NetTest
{
    public class SecsGemUnitTests
    {
        [Fact]
        public async Task SecsGemSendAsync_WhenSendManyMessage_CannotOccurT3()
        {
            var active = new SecsGem(true, IPAddress.Loopback, 5000) { T3 = 100 };
            var passive = new SecsGem(false, IPAddress.Loopback, 5000) { T3 = 100 };
            passive.Start();
            active.Start();

            SpinWait.SpinUntil(() => active.State == ConnectionState.Selected);
            int sendCount = 500;
            passive.PrimaryMessageReceived += PassiveOnPrimaryMessageReceived;

            var tasks = new List<Task>();
            var exception = await Record.ExceptionAsync(async () =>
            {
                int group = 100;
                for (var g = 0; g < sendCount / group; g++)
                {
                    var g1 = g;
                    var task = Enumerable.Range(0, group)
                        .Select(i =>
                        {
                            Console.Out.WriteLine(i + (g1 * group));
                            var msg = new SecsMessage(1, 1);
                            return active.SendAsync(msg);
                        })
                        .ToArray();

                    Console.Out.WriteLine("=======");
                    tasks.AddRange(task);
                    await Task.Delay(100);
                }
                await Task.WhenAll(tasks.ToArray());
            });

            passive.PrimaryMessageReceived -= PassiveOnPrimaryMessageReceived;
            Assert.Null(exception);
        }

        private void PassiveOnPrimaryMessageReceived(object sender, PrimaryMessageWrapper e)
        {
            e.ReplyAsync(new SecsMessage(1, 2, replyExpected: false));
        }
    }
}
  1. See error after the test.

Expected behavior
All sending messages should reply successfully without any timeout log.

Desktop

  • Windows 10
  • VS2019 with secs4net target framework : .Net standard 2.0 and XUnit target framework: .Net Framework 4.8

Additional context
The similar test would not occur in V2 ( after commit id: ac520f7 ),
but I can't migrate my system to .Net 6.0.

Add the V2 xUnit as below for your reference.

 [Fact]
public void SecsGem_SendAsync_Does_T3_Occur_When_Sending_A_Large_Number_Of_Messages_At_Once()
{
    var options1 = Options.Create(new SecsGemOptions
    {
        SocketReceiveBufferSize = 32,
        DeviceId = 0,
        T3 = 10000,
    });
    using var secsGem1 = new SecsGem(options1, connector1, Substitute.For<ISecsGemLogger>());
    using var secsGem2 = new SecsGem(options1, connector2, Substitute.For<ISecsGemLogger>());



    var ping = new SecsMessage(s: 1, f: 13)
    {
        SecsItem = A("Ping"),
    };
    var pong = new SecsMessage(s: 1, f: 14, replyExpected: false)
    {
        SecsItem = A("Pong"),
    };



    using var cts = new CancellationTokenSource();



    _ = Task.Run(async () =>
    {
        await foreach (var a in secsGem2.GetPrimaryMessageAsync(cts.Token))
        {
            Console.WriteLine("Ack");
            await a.TryReplyAsync(pong);
        }
    });



    var sendCount = 2000;
    var tasks = new List< ValueTask<SecsMessage?>>();



    Func<Task> sendAsync = async () =>
    {
        int group = 200;
        for (var g = 0; g < sendCount / group; g++)
        {
            var g1 = g;



            var task = Enumerable.Range(0, group)
                .Select(i =>
                {
                    Console.Out.WriteLine(i + (g1 * group));
                    Console.WriteLine($"SystemByte = 0x{Convert.ToString(ping.Id, 16)}, DateTime.Now: {DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff")}");
                    return secsGem1.SendAsync(ping, cts.Token);
                })
                .ToArray();
            tasks.AddRange(task);
            await Task.Delay(1);
        }
        //await Task.WhenAll(tasks.ToArray());
    };
    Thread.Sleep(10000);



    sendAsync.Should().NotThrow<SecsException>();//.WithMessage(Resources.T3Timeout);
    sendAsync.Should().NotThrow<Exception>();//.WithMessage(Resources.T3Timeout);
}

Hello MKJEFF,Do you have a develop doc for secs4net?

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Request/Suggestion

On 64bit platform pc, all proj need to change to x.86 compile, Need exception catch on wpf loading because of xml parser error cause issue, appconfig need add in useLegacyV2RuntimeActivationPolicy="true" on my pc.
Really need solution pre-define build order because still unable to figure out how,
I tried about a day but till now, no chance running all proj syn.
Please put more documention mk. This really is impressive proj.
Far beyond my level though, cheers.!
Thanks.

I got Unhandled exception occurred on PipeDecoder producer

Hi, I run my app (passive) on 13.00 PM and got Unhandled exception occurred on PipeDecoder producer on 08.00 PM
and then can't connect host (active) until re-initial host,
I don't know what to do please can you help me?

*** logging ***
[05/09/2565 20:49:54 [Error] T3 Timeout[id=0x692EDA2E]: 45 sec.
[05/09/2565 20:49:09 [Error] Unhandled exception occurred on PipeDecoder producer
[05/09/2565 13:58:50 [MessageOut] REQUEST SPOOLED DATA ACKNOWLEDGE:'S6F24'
<B [1] 0x02>
.

[05/09/2565 13:58:50 [MessageIn] 'S6F23'W
<U1 [1] 0>
.

[05/09/2565 13:58:50 [MessageOut] CEEB:'S2F38'
<B [1] 0x00>
.

image

Desktop
OS: Windows 10 pro 64 bit

Turn On the eqp one more time

Hello Sir

When EQP is ON, the app is normal
1
at this time,I OFF the EQP,the app is normal too
2
but when I ON the EQP one more time,the app shows selected
3
for a while the app shows connecting
4

sorry,my english is poor。

In some cases, the Secs server cannot connect

Describe the bug
In some cases, the Secs server cannot connect。Passive/Active SecsDevice can not connect each other’.

To Reproduce
Steps to reproduce the behavior:

  1. Start 2 Active SecsDevice and 1 Passive SecsDevice, then enable them.
  2. On the Passive SecsDevice ,Alternate click Enable button and Disable button at 5 seconds intervals。
  3. See,3 SecsDevice will Enter Hte "Connectting" State. Passive SecsDevice will never work properly

    Expected behavior
    This may be cause by multithread. In file SecsGem.cs ,_startImpl may be Start many times。
    Each communication error occurr will trigger function "CommunicationStateChanging(in ConnectionState newState)",then _startImpl will be started. If multiple errors occur simultaneously,multiple _startImpl threads will start。But we only have one woke socket.
    socket will be open and close in more than one _startImpl thread.
    How do we ensure that there is only one _startImpl thread running when multiple error occurs

Screenshots

screen

Desktop (please complete the following information):

  • OS: [Win 7]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

How to get device

Hallo, 你好。我在学习readme上的例子。请问如何获取device呢?
var s3f18 = await device.SendAsync(s3f17);

public static Item ToItem(this JObject jobject)这个方法有问题?

public static Item ToItem(this JObject jobject)
{
var json = (JProperty)jobject.First;

        switch (json.Name) //?json.value?
        {
            case nameof(SecsFormat.List): return L(json.Value.Value<JArray>().Values<JObject>().Select(ToItem));
            case nameof(SecsFormat.ASCII): return A(json.Value.Value<string>());
            case nameof(SecsFormat.JIS8): return J(json.Value.Value<string>());
            case nameof(SecsFormat.Binary): return B(json.Value.Values<byte>());
            case nameof(SecsFormat.Boolean): return Boolean(json.Value.Values<bool>());
            case nameof(SecsFormat.F4): return F4(json.Value.Values<float>());
            case nameof(SecsFormat.F8): return F8(json.Value.Values<double>());
            case nameof(SecsFormat.I1): return I1(json.Value.Values<sbyte>());
            case nameof(SecsFormat.I2): return I2(json.Value.Values<short>());
            case nameof(SecsFormat.I4): return I4(json.Value.Values<int>());
            case nameof(SecsFormat.I8): return I8(json.Value.Values<long>());
            case nameof(SecsFormat.U1): return U1(json.Value.Values<byte>());
            case nameof(SecsFormat.U2): return U2(json.Value.Values<ushort>());
            case nameof(SecsFormat.U4): return U4(json.Value.Values<uint>());
            case nameof(SecsFormat.U8): return U8(json.Value.Values<ulong>());
            default: throw new ArgumentOutOfRangeException($"Unknown item format: {json.Name}");
        }
    }

Memory Grown Issues

Hi,

Is there anyone facing the memory grow issues running over 24/7 ?
From my observation, the memory allocations of my application
will keep on increasing upon sending the new secs message.
Is it normal ?

registering COM

Hello, I am in version 4.8 and want to encapsulate it as com, but it prompts that ISecsGemLogger is not registered, can you tell me how to do this?
Can you tell me how to change to .net 4.8 version, I need to access COM

.net framework

can i change the 4.6.2 microsoft.net framework to 4.5.2 ? is there any problem?

Receiving large reply message

hi Jeff
I was running the EAPhost, after sending an S1F3 requesting all SVs, the eq replied with over 400 items, and after receiving the first buffer (0x4000 bytes), the program stopped responding to any action, and soon ended itself. I tried to use some try catches, but none break point in the exception section was spotted.
appreciation for any reply.

License?

Hello!
I find no license information about this project. Can you please add it? Is it licensed under MIT terms?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.