Giter Site home page Giter Site logo

t-c-plotter's Introduction

T C Plotter

Tcp plotter in language c.

img

To build and run

setup_glfw.bat
build_msvc.bat
main.exe

Why

  • To live stream data from somewhere to plot it.

The good

  • It's faster than anything else.
  • It's easyer to implement client for in any language e.g.:
public class TcpPlotter : IDisposable {
  public TcpPlotter() {
    _tcpClient = new TcpClient();
    _writeThread = new Thread(SendingProc);
    _writeThread.Start();
  }
  public void Plot(double d) {
    _q.Enqueue(d);
  }
  public void Dispose() {
    shouldStop = true;
    _tcpClient.Close();
    _tcpClient.Dispose();
    _writeThread.Join();
  }
  private async void SendingProc() {
    while (!shouldStop) {
      try {
        _tcpClient.Connect(new System.Net.IPEndPoint(System.Net.IPAddress.Loopback, 42069));
        while (!shouldStop) {
          if (_q.Count > 0) {
            var val = _q.Dequeue();
            var bytes = System.Text.Encoding.UTF8.GetBytes($"{val} ");
            await _tcpClient.GetStream().WriteAsync(bytes);
          }
          else {
            await Task.Delay(50);
          }
        }
      }
      catch (Exception Ex) {
        await Task.Delay(50);
      }
    }
  }
  private readonly TcpClient _tcpClient;
  private readonly Thread _writeThread;
  private readonly Queue<double> _q = new Queue<double>();
  private bool shouldStop = false;
}
  • python client most likely shorter.
  • You can zoom in and out infinitly ( more or less )
  • You can pan by pressing right mouse button and dragging

The bad

  • Hardcoded port number ( No need for changing it! )
  • Bad documentation
  • More or less 0 actions ( no hover over line, no different scales, no menu of any kind, no nothing... )
  • Bad arhitecture ( more or less )

The ugly

  • Hardcoded for windows.
  • Used msvc specific stuff.

t-c-plotter's People

Contributors

rexim avatar branc116 avatar kolumb avatar

Watchers

 avatar  avatar

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.