Reasons for using RPC - c

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.

Related

how to use zerotier in socket programming?

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.

Is there a standard way of doing RPCs with rabbitmq-c

In the RabbitMQ tutorials there's a demonstration of how to do remote process calls in all but C-languages (C, C++). I'm using rabbitmq-c and I'm close to replicating what the Python tutorial is doing, after all correlation_id and reply_to are available fields in the amq_basic_properties.
That been said, I can see the following two methods in the amqp.h header:
amq_simple_rpc
amq_simple_rpc_decoded
It's my understanding that these are used internally for the library's communication with the broker (e.g. that how a call to create a queue goes through) but I was wondering whether I can use those directly to support my own remote process calls, i.e. have a function that "lives" in one client and make it callable by another client.
If these methods can't be used like this, is there a standard alternative or a description of how to do routed RPCs with librabbitmq-c? Is my approach of replicating the pika tutorial "sane"?
You're right in your suspicion that amq_simple_rpc etc are for low-level client-broker communication. They are indeed unsuitable for (broker-mediated) client-to-client communication.
My opinion is that your approach following the pika tutorial is sensible. I'm afraid I do not know of any standard RPC helper library for librabbitmq-c.

Are C sockets and socket.io/Websockets from React compatible?

So I've created a simple chatserver / chatclient in C. The chatclient reads from stdin and outputs to stdout. The goal is to adapt this to a frontend web UI. I was thinking of using React and it seems like the most commonly used socket libraries are socket.io or Websockets.
So my big question is: can I replace my chatclient I've built in C with a React chatclient that uses socket.io or Websockets to connect to my chatserver in C?
Are the two sockets compatible?
The answer is both "Yes" and "No", but the answer given by justcivah probably should have been "No", since it lacks vital information (edit: the referenced answer was deleted)...
The reason is that WebSockets is a protocol, so your server needs to understand that specific protocol.
The WebSockets protocol usually runs as an additional layer over TCP/IP sockets (which is the only layer you probably have on your C chatserver), and it includes additional ("header") data before the "message" (payload). WebSockets also require an HTTP based handshake (though other possible handshakes might be added in the future).
There are a number of different WebSocket libraries in C that could help you implement the WebSockets protocol in your C chatserver - just search for C WebSocket Framework or something like that.

Call (or send event) erlang function from C app/library

I have an application and library that interacts with low-level hardware protocols. Now I'm writing an erlang application for fast parsing of data and send it to distributed databases. However, I'm a newbie at erlang and I've stuck at simple thing: what is the efficient way to connect C library(or application) with erlang and how to notify erlang that another block of data is ready for processing (e.g. how to call erlang function from C library or trigger an event)? Time is important here, and what shall I use -- simple ports, driver ports or NIFs? Or there are better ways for solving my task?
as an option, you can run your C application as hidden erlang node using erl_interface lib. http://www.erlang.org/doc/apps/erl_interface/ei_users_guide.html#id56593 . And send messages to real erlang node http://www.erlang.org/doc/apps/erl_interface/ei_users_guide.html#id60866, or use rpc - remote proc calls to perform http://www.erlang.org/doc/apps/erl_interface/ei_users_guide.html#id57714
You should try simple port first sending events to stdout. If the bandwidth of such implementation is enough, you have the benefit of erlang vm be safe from crashes of your application. If you need more then using port driver is an option, that interface was developed exactly for such purposes.

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