You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To start, thanks Joel for your efforts on this repository.
This is more of design question/discussion. I'm porting some code from an old WinForms application to a more modern architecture using Avalonia.
The code being ported was using the TCPListener/TCPClient in it's raw form which proved to just work but wanted a bit more robustness and simplicity with the library.
My current setup is:
GUI frontend that talks with a 'middleware' piece of 'C' software that acts as a mediator between the GUI and a final end point.
GUI front-end that:
Establishes a server service using loopback on a given port. The server is responsible for receiving data from this middleware and displays data as needed (which is transmitted from the end point).
Establishes a client service using loopback on a given port. The client is responsible for taking UI data and sending to middleware which then sends to final end point.
The middleware piece is to remained untouched
The issue I'm running into from legacy software to new implementation is "single" transmits from 'final endpoint -> middleware -> GUI'. I noticed when data is 'set' on the end point and progresses through this line of transmission, my DataReceived function doesn't reliably get the data that is sent from the middleware. I do see it being sent as I have the means to debug it but it always seems like the data gets lost or dropped.
Scenario would be:
Final endpoint pushes a button
End point transmits the data associated w/ button press
Middleware processes
Middleware then relays the data to GUI
However, when data from the middleware sends the data in a periodic fashion, I'm not seeing any issue with receiving it. I'm assuming the periodic nature of this is what's helping.
Any ideas on implementation? I put my DataReceived function below:
privatevoidDataReceived(object?sender, SuperSimpleTcp.DataReceivedEventArgs e){// TODO: This 'message' doesn't always come in.if(e.Data.Array[4]==0x08&& e.Data.Array[5]==0x01&&(e.Data.Array[6]==0x00|| e.Data.Array[6]==0x01)){
Debug.WriteLine("Received My Non-Periodic Message");}try{byte[]?data= e.Data.Array;if(data is not null&& data.Length >0){// Convert the first 4 bytes (length of data)intdataLength= IPAddress.NetworkToHostOrder(BitConverter.ToInt32(data,0));// Extract the rest of the databyte[]dataPayload=newbyte[dataLength];
Array.Copy(data,4, dataPayload,0, dataLength);
ProcessStatusData(dataPayload);}}catch(Exceptionex){
Debug.WriteLine(ex.ToString());}}
This discussion was converted from issue #214 on August 29, 2024 03:27.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
To start, thanks Joel for your efforts on this repository.
This is more of design question/discussion. I'm porting some code from an old WinForms application to a more modern architecture using Avalonia.
The code being ported was using the TCPListener/TCPClient in it's raw form which proved to just work but wanted a bit more robustness and simplicity with the library.
My current setup is:
GUI frontend that talks with a 'middleware' piece of 'C' software that acts as a mediator between the GUI and a final end point.
The issue I'm running into from legacy software to new implementation is "single" transmits from 'final endpoint -> middleware -> GUI'. I noticed when data is 'set' on the end point and progresses through this line of transmission, my
DataReceived
function doesn't reliably get the data that is sent from the middleware. I do see it being sent as I have the means to debug it but it always seems like the data gets lost or dropped.Scenario would be:
However, when data from the middleware sends the data in a periodic fashion, I'm not seeing any issue with receiving it. I'm assuming the periodic nature of this is what's helping.
Any ideas on implementation? I put my
DataReceived
function below:Beta Was this translation helpful? Give feedback.
All reactions