Coder Social home page Coder Social logo

vsm_connection's Introduction

libvsmsocket

This C library provides a way to remotely exchange simple signals with a VSM instance via a TCP socket.

Building

To generate the Makefile using Autotools:

./autogen.sh
./configure

Then it's make as usual.

Using

First, initialise an instance to listen on a port and accept incoming connections with vsm_socket_init(). Then wait for an incoming VSM client connection with vsm_socket_accept().

The main loop is typically run in separate threads to read and write signals with vsm_socket_receive() and vsm_socket_send() and its variants for each primitive type.

Then call vsm_socket_close() to close a client connection, and finally vsm_socket_free() to dispose of the vsm_socket instance.

Signals are exchanged in plain text using this standard format:

"signal=value\n"

To open a client connection from the VSM instance, use the ipc.SocketIPC class with the hostname and port number of where the socket is listening.

Sample app: vsmsocket

A sample application vsmsocket is also provided and built along the libvsmsocket.a static library to illustrate how to use it and for debugging purposes. While it can be used with a regular VSM client, netcat or nc is a good way of showing what it does or testing the library. For example, with one shell for the server vsmsocket and another one for the client nc:

$ ./build/vsmsocket -p12345
$ nc localhost 12345

Signals entered on the server shell will be sent to the client, and the other way round when using the client shell.

White spaces are stripped around the signal and values, but there needs to be one equal sign. These signal strings are valid:

mySignal=123
hello =  good-bye

However, these ones aren't valid and will raise an error:

hello
otherSignal someValue

vsm_connection's People

Contributors

gctucker avatar magnusfeuer avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  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.