how to use zerotier in socket programming? - file

I am trying to create a file sharing application in which socket programming is done through c language and GUI is done using java. I am connecting c and java using JNI(java native interface).
Now to install this appication in different systems and establish communication between these application I was thinking of using zerotier, but I am not sure how to use zerotier to do this work of file sharing.

ZeroTier provides a BSD-style socket layer via the SDK (libzt).
Documentation / Examples: docs.zerotier.com/sockets
Github Repo: zerotier/libzt.
Basically you'd just build the library into your application and call the special ZT sockets in the same way you'd call normal sockets.

Related

Does Cn1 support serial ports?

I will need the ability to communicate with a device attached via USB that shows up as a serial port. Is this possible with cn1? I haven't seen any reference to it. Does the native java import javax.comm.*; work on all platforms?
No, comm isn't portable. You would be able to bundle it into the desktop port but you'd need a different implementation for everything else using the native interfaces.
Before we had builtin support for sockets Steve created a cn1lib for socket support which you can use as a reference to how one would implement streaming data over native interfaces

REST and C process integration

I have a need to provide restful api support to a linux deamon process that will maintain and manipulate a in-memory table (simple C structure of arrays). This deamon will act as a configuration entity and will relay the table contents to another process on its bootup or during configuration request.
Now in this context i would be happy to obtain the following information:
Would it be good to have an integrated web server or have an independent web server and talk to this daemon. Please note this server would not be required to handle huge loads.
Please suggest some good web servers with good REST support.
If an independent web server then what is the best mechanism for web server to deamon communication.
Please note this would be deployed on a small embedded board running debian.
Well, a possible solution is based on developing a CGI that is executed by any webserver (apache, lighttpd, ...) . This program connects to the main daemon with an IPC mechanism such as sockets, fifos or message queues and after interacting with the daemons returns the desired output to the REST client.
The CGI program can be written in any language, but if you want to write it in C, check this project: it's a CGI program written in C that takes commands for an IP camera. The connection with a main daemon is not implemented, since it was outside the scope of the project. I like it because it has an embedded XML parser and does not require any external library

Reasons for using RPC

I am planning on writing a client/server application. Both the server and client components will be written in C. I was looking at C socket libraries which can help me with this project and I started to read about RPC.
Is RPC used in most client/server programs?
What are the reasons to use RPC as opposed to writing your own socket code?
ONC RPC originated in the 1980's and has been worked on since then; consequently, it's very robust, efficient, and documented.

Linux and Windows socket APIs

I want to port some Linux-specific code to Windows which contains socket operations. Is there any third party library available for Linux/BSD sockets to Winsock mapping like the pthread-w32 library, which is used for the threading operation? Also, I can't use the Cygwin tool chain.
Well, I'm still working on this, but it's a start for new programs: https://sourceforge.net/projects/libxc/

Windows C socket programming for UDP client

I am trying to lookup some example programs for windows socket. Particularly, I am interested in writing a client in C (in visual studio) which communicates to the server using UDP. I din't find any concrete material. I tried some examples but got some linking errors. Is there any library available. Please let me know.
Thanks in advance.
The Apache Portable Runtime supports sockets, and it is cross platform.
I've found a simple library, which provides implementation of networking, but it is for C++. (C++ Socket Class for Windows). You can look at it's implementation of working with sockets, or just use it (there are examples of simple client and server).

Resources